org.apache.hadoop.hive.serde2.binarysortable
Class OutputByteBuffer

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.binarysortable.OutputByteBuffer

public class OutputByteBuffer
extends Object

This class is much more efficient than ByteArrayOutputStream because none of the methods are synchronized.


Constructor Summary
OutputByteBuffer()
           
 
Method Summary
 String dumpHex()
          Return the bytes in hex format.
 byte[] getData()
          Returns the underlying byte array.
 int getLength()
          Returns the current length.
 void reset()
          Reset the byte buffer.
 void write(byte b)
           
 void write(byte b, boolean invert)
          Write one byte to the byte buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputByteBuffer

public OutputByteBuffer()
Method Detail

reset

public void reset()
Reset the byte buffer.


write

public final void write(byte b)

write

public final void write(byte b,
                        boolean invert)
Write one byte to the byte buffer. Final method to help inlining.

Parameters:
invert - whether we want to invert all the bits.

getData

public final byte[] getData()
Returns the underlying byte array.


getLength

public final int getLength()
Returns the current length.


dumpHex

public String dumpHex()
Return the bytes in hex format.



Copyright © 2012 The Apache Software Foundation