org.apache.hadoop.hbase.io
Class ByteBufferOutputStream
java.lang.Object
java.io.OutputStream
org.apache.hadoop.hbase.io.ByteBufferOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class ByteBufferOutputStream
- extends OutputStream
Not thread safe!
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
buf
protected ByteBuffer buf
ByteBufferOutputStream
public ByteBufferOutputStream(int capacity)
ByteBufferOutputStream
public ByteBufferOutputStream(int capacity,
boolean useDirectByteBuffer)
size
public int size()
getByteBuffer
public ByteBuffer getByteBuffer()
- This flips the underlying BB so be sure to use it _last_!
- Returns:
- ByteBuffer
write
public void write(int b)
throws IOException
- Specified by:
write
in class OutputStream
- Throws:
IOException
writeTo
public void writeTo(OutputStream out)
throws IOException
- Writes the complete contents of this byte buffer output stream to
the specified output stream argument.
- Parameters:
out
- the output stream to which to write the data.
- Throws:
IOException
- if an I/O error occurs.
write
public void write(byte[] b)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
write
public void write(byte[] b,
int off,
int len)
throws IOException
- Overrides:
write
in class OutputStream
- Throws:
IOException
flush
public void flush()
throws IOException
- Specified by:
flush
in interface Flushable
- Overrides:
flush
in class OutputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class OutputStream
- Throws:
IOException
toByteArray
public byte[] toByteArray(int offset,
int length)
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.