org.fusesource.hawtbuf
Class BufferOutputStream
java.lang.Object
java.io.OutputStream
org.fusesource.hawtbuf.BufferOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public final class BufferOutputStream
- extends OutputStream
Very similar to the java.io.ByteArrayOutputStream but this version
is not thread safe and the resulting data is returned in a Buffer
to avoid an extra byte[] allocation. It also does not re-grow it's
internal buffer.
- Author:
- Hiram Chirino
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BufferOutputStream
public BufferOutputStream(int size)
BufferOutputStream
public BufferOutputStream(byte[] buffer)
BufferOutputStream
public BufferOutputStream(Buffer data)
write
public void write(int b)
throws IOException
- Specified by:
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
getNextBuffer
public Buffer getNextBuffer(int len)
throws IOException
- Throws:
IOException
reset
public void reset()
toBuffer
public Buffer toBuffer()
toByteArray
public byte[] toByteArray()
size
public int size()
Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.