Examples of ByteBufferObjectInspector


Examples of org.apache.crunch.types.orc.TupleObjectInspector.ByteBufferObjectInspector

  @Test
  public void testByteBufferObjectInspector() {
    byte[] bytes = {0, 9, 4, 18, 64, 6, 1};
    BytesWritable bw = new BytesWritable(bytes);
    ByteBuffer buf = ByteBuffer.wrap(bytes);
    ByteBufferObjectInspector bboi = new ByteBufferObjectInspector();
   
    assertArrayEquals(bytes, bboi.getPrimitiveJavaObject(buf));
    assertEquals(bw, bboi.getPrimitiveWritableObject(buf));
    assertEquals(buf, bboi.create(bytes));
    assertEquals(buf, bboi.create(bw));
   
    ByteBuffer newBuf = bboi.copyObject(buf);
    assertTrue(buf != newBuf);
    assertEquals(buf, newBuf);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.