public class TestByteBufferUtils extends Object
Modifier and Type | Field and Description |
---|---|
private byte[] |
array |
static HBaseClassTestRule |
CLASS_RULE |
private static int |
MAX_VLONG_LENGTH |
private static Collection<Long> |
testNumbers |
private static String |
UNSAFE_AVAIL_NAME |
private static String |
UNSAFE_UNALIGNED_NAME |
Constructor and Description |
---|
TestByteBufferUtils(boolean useUnsafeIfPossible) |
Modifier and Type | Method and Description |
---|---|
private static void |
addNumber(Set<Long> a,
long l) |
static void |
afterClass() |
(package private) static void |
detectAvailabilityOfUnsafe() |
(package private) static void |
disableUnsafe() |
private static void |
fillArray(byte[] bb,
byte b) |
private static void |
fillBB(ByteBuffer bb,
byte b) |
static Collection<Object[]> |
parameters() |
private static void |
setUnsafe(String fieldName,
boolean value) |
void |
setUp()
Create an array with sample data.
|
void |
testArePartEqual()
Test if we are comparing equal bytes.
|
void |
testCompareTo() |
void |
testCompressedInt()
Test 7-bit encoding of integers.
|
private void |
testCompressedInt(int value) |
void |
testConsistencyWithHadoopVLong() |
void |
testCopyFromArrayToBuffer() |
void |
testCopyFromBuffer()
Test copying from buffer.
|
void |
testCopyFromBufferToArray() |
void |
testCopyFromSrcToDestWithThreads() |
private void |
testCopyFromSrcToDestWithThreads(Object input,
Object output,
List<Integer> lengthes,
List<Integer> offsets) |
void |
testCopyFromStream()
Test copying data from stream.
|
void |
testCopyToStreamWithOffset()
Test copying to stream from buffer with offset.
|
void |
testEquals() |
void |
testIntFitsIn()
Test how much bytes we need to store integer.
|
void |
testLongFitsIn()
Test how much bytes we need to store long.
|
void |
testMoveBufferToStream()
Test copying to stream from buffer.
|
void |
testPutInt()
Test serializing int to bytes
|
private void |
testPutInt(int value) |
void |
testReadWriteVLong() |
void |
testRelativeCopyFromBuffertoBuffer() |
void |
testToBytes() |
void |
testToPrimitiveTypes() |
public static final HBaseClassTestRule CLASS_RULE
private static final String UNSAFE_AVAIL_NAME
private static final String UNSAFE_UNALIGNED_NAME
private byte[] array
private static final int MAX_VLONG_LENGTH
private static final Collection<Long> testNumbers
public TestByteBufferUtils(boolean useUnsafeIfPossible) throws Exception
Exception
public static void afterClass() throws Exception
Exception
public static Collection<Object[]> parameters()
private static void setUnsafe(String fieldName, boolean value) throws Exception
Exception
static void disableUnsafe() throws Exception
Exception
static void detectAvailabilityOfUnsafe() throws Exception
Exception
public void setUp()
public void testReadWriteVLong()
public void testConsistencyWithHadoopVLong() throws IOException
IOException
public void testMoveBufferToStream()
public void testCopyToStreamWithOffset() throws IOException
IOException
- On test failure.public void testCopyFromStream() throws IOException
IOException
- On test failure.public void testCopyFromBuffer()
public void testCompressedInt() throws IOException
IOException
- On test failure.public void testIntFitsIn()
public void testLongFitsIn()
public void testArePartEqual()
public void testPutInt()
private void testCompressedInt(int value) throws IOException
IOException
private void testPutInt(int value)
public void testToBytes()
public void testToPrimitiveTypes()
public void testCopyFromArrayToBuffer()
private void testCopyFromSrcToDestWithThreads(Object input, Object output, List<Integer> lengthes, List<Integer> offsets) throws InterruptedException
InterruptedException
public void testCopyFromSrcToDestWithThreads() throws InterruptedException
InterruptedException
public void testCopyFromBufferToArray()
public void testRelativeCopyFromBuffertoBuffer()
public void testCompareTo()
public void testEquals()
private static void fillBB(ByteBuffer bb, byte b)
private static void fillArray(byte[] bb, byte b)
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.