@Test void testCreatingSubBuffer() { byte[] ints = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; ByteBuffer bb = ByteBuffer.wrap(ints); ByteBuffer subBuffer = Utils.createSubBuffer(bb, 3); assertThat(subBuffer.limit(), is(equalTo(3))); assertThat(bb.position(), is(equalTo(3))); }
public static ByteBuffer createSubBuffer(ByteBuffer source, int length) { ByteBuffer headerData = source.slice(); headerData.limit(length); headerData.order(source.order()); source.position(source.position() + length); return headerData; }
Utils { public static ByteBuffer createSubBuffer(ByteBuffer source, int length) { ByteBuffer headerData = source.slice(); headerData.limit(length); headerData.order(source.order()); source.position(source.position() + length); return headerData; } }
Utils { public static ByteBuffer createSubBuffer(ByteBuffer source, int length) { ByteBuffer headerData = source.slice(); headerData.limit(length); headerData.order(source.order()); source.position(source.position() + length); return headerData; } private  Utils(); }
Utils { public static ByteBuffer createSubBuffer(ByteBuffer source, int length) { ByteBuffer headerData = source.slice(); headerData.limit(length); headerData.order(source.order()); source.position(source.position() + length); return headerData; } 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 ByteBuffer createSubBuffer(ByteBuffer source, int length) { ByteBuffer headerData = source.slice(); headerData.limit(length); headerData.order(source.order()); source.position(source.position() + length); return headerData; } 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);  }