Java Code Examples for org.apache.hadoop.hbase.util.Bytes#vintToBytes()

The following examples show how to use org.apache.hadoop.hbase.util.Bytes#vintToBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ByteUtilTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Test
public void testVIntToBytes() {
    for (int i = -10000; i <= 10000; i++) {
        byte[] vint = Bytes.vintToBytes(i);
        int vintSize = vint.length;
        byte[] vint2 = new byte[vint.length];
        assertEquals(vintSize, ByteUtil.vintToBytes(vint2, 0, i));
        assertTrue(Bytes.BYTES_COMPARATOR.compare(vint,vint2) == 0);
    }
}
 
Example 2
Source File: ByteUtilTest.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Test
public void testVIntToBytes() {
    for (int i = -10000; i <= 10000; i++) {
        byte[] vint = Bytes.vintToBytes(i);
        int vintSize = vint.length;
        byte[] vint2 = new byte[vint.length];
        assertEquals(vintSize, ByteUtil.vintToBytes(vint2, 0, i));
        assertTrue(Bytes.BYTES_COMPARATOR.compare(vint,vint2) == 0);
    }
}
 
Example 3
Source File: ByteUtilTest.java    From phoenix with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testVIntToBytes() {
    for (int i = -10000; i <= 10000; i++) {
        byte[] vint = Bytes.vintToBytes(i);
        int vintSize = vint.length;
        byte[] vint2 = new byte[vint.length];
        assertEquals(vintSize, ByteUtil.vintToBytes(vint2, 0, i));
        assertTrue(Bytes.BYTES_COMPARATOR.compare(vint,vint2) == 0);
    }
}