@Test void testMovingBufferToNextEightBytePosition() { ByteBuffer bb = ByteBuffer.allocate(20); bb.position(1); Utils.seekBufferToNextMultipleOfEight(bb); assertThat(bb.position(), is(equalTo(8))); bb.position(14); Utils.seekBufferToNextMultipleOfEight(bb); assertThat(bb.position(), is(equalTo(16))); }
public static void seekBufferToNextMultipleOfEight(ByteBuffer bb) { int pos = bb.position(); if (pos % 8 == 0) { return; } bb.position(pos + (8 - (pos % 8))); }
Utils { public static void seekBufferToNextMultipleOfEight(ByteBuffer bb) { int pos = bb.position(); if (pos % 8 == 0) { return; } bb.position(pos + (8 - (pos % 8))); } }
Utils { public static void seekBufferToNextMultipleOfEight(ByteBuffer bb) { int pos = bb.position(); if (pos % 8 == 0) { return; } bb.position(pos + (8 - (pos % 8))); } private  Utils(); }
Utils { public static void seekBufferToNextMultipleOfEight(ByteBuffer bb) { int pos = bb.position(); if (pos % 8 == 0) { return; } bb.position(pos + (8 - (pos % 8))); } private  Utils(); static String toHex(long address); static String readUntilNull(ByteBuffer buffer); static boolean validateName(String name); static void seekBufferToNextMultipleOfEight(ByteBuffer bb); static int readBytesAsUnsignedInt(ByteBuffer buffer, int length); static long readBytesAsUnsignedLong(ByteBuffer buffer, int length); static ByteBuffer createSubBuffer(ByteBuffer source, int length); static int bitsToInt(BitSet bits, int start, int length); static int bytesNeededToHoldNumber(long number); static int[] linearIndexToDimensionIndex(int index, int[] dimensions); static int dimensionIndexToLinearIndex(int[] index, int[] dimensions); static int[] chunkIndexToChunkOffset(int chunkIndex, int[] chunkDimensions, int[] datasetDimensions); static int[] stripLeadingIndex(int[] dims); }
Utils { public static void seekBufferToNextMultipleOfEight(ByteBuffer bb) { int pos = bb.position(); if (pos % 8 == 0) { return; } bb.position(pos + (8 - (pos % 8))); } private  Utils(); static String toHex(long address); static String readUntilNull(ByteBuffer buffer); static boolean validateName(String name); static void seekBufferToNextMultipleOfEight(ByteBuffer bb); static int readBytesAsUnsignedInt(ByteBuffer buffer, int length); static long readBytesAsUnsignedLong(ByteBuffer buffer, int length); static ByteBuffer createSubBuffer(ByteBuffer source, int length); static int bitsToInt(BitSet bits, int start, int length); static int bytesNeededToHoldNumber(long number); static int[] linearIndexToDimensionIndex(int index, int[] dimensions); static int dimensionIndexToLinearIndex(int[] index, int[] dimensions); static int[] chunkIndexToChunkOffset(int chunkIndex, int[] chunkDimensions, int[] datasetDimensions); static int[] stripLeadingIndex(int[] dims);  }