public static long sizeOf(byte[] array) { return (array == null) ? 0 : sizeOfByteArray(array.length); }
public static long sizeOf(byte[] array) { return (array == null) ? 0 : sizeOfByteArray(array.length); }
public static int estimatedInMemorySize(int indexBitLength) { // note: we don't take into account overflow entries since their number can vary return (int) (DENSE_INSTANCE_SIZE + SizeOf.sizeOfByteArray(numberOfBuckets(indexBitLength) / 2)); }
public static int estimatedInMemorySize(int indexBitLength) { // note: we don't take into account overflow entries since their number can vary return (int) (DENSE_INSTANCE_SIZE + SizeOf.sizeOfByteArray(numberOfBuckets(indexBitLength) / 2)); }
@Test public void testRetainedSize() { int bufferSize = 1024; InputStreamSliceInput input = new InputStreamSliceInput(new ByteArrayInputStream(new byte[] {0, 1}), bufferSize); assertEquals(input.getRetainedSize(), ClassLayout.parseClass(InputStreamSliceInput.class).instanceSize() + sizeOfByteArray(bufferSize)); }
@Test public void testRetainedSize() { int bufferSize = 1024; InputStreamSliceInput input = new InputStreamSliceInput(new ByteArrayInputStream(new byte[] {0, 1}), bufferSize); assertEquals(input.getRetainedSize(), ClassLayout.parseClass(InputStreamSliceInput.class).instanceSize() + sizeOfByteArray(bufferSize)); }
@Test public void testRetainedSize() throws Exception { int sliceInstanceSize = ClassLayout.parseClass(Slice.class).instanceSize(); Slice slice = Slices.allocate(10); assertEquals(slice.getRetainedSize(), sizeOfByteArray(10) + sliceInstanceSize); assertEquals(slice.length(), 10); Slice subSlice = slice.slice(0, 1); assertEquals(subSlice.getRetainedSize(), sizeOfByteArray(10) + sliceInstanceSize); assertEquals(subSlice.length(), 1); }
@Test public void testRetainedSize() throws Exception { int sliceInstanceSize = ClassLayout.parseClass(Slice.class).instanceSize(); Slice slice = Slices.allocate(10); assertEquals(slice.getRetainedSize(), sizeOfByteArray(10) + sliceInstanceSize); assertEquals(slice.length(), 10); Slice subSlice = slice.slice(0, 1); assertEquals(subSlice.getRetainedSize(), sizeOfByteArray(10) + sliceInstanceSize); assertEquals(subSlice.length(), 1); }