org.apache.activemq.protobuf
Class BufferOutputStream
java.lang.Object
java.io.OutputStream
org.apache.activemq.protobuf.BufferOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
public final class BufferOutputStream
- extends java.io.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.
Methods inherited from class java.io.OutputStream |
close, flush, write |
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 java.io.IOException
- Specified by:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
write
in class java.io.OutputStream
- Throws:
java.io.IOException
getNextBuffer
public Buffer getNextBuffer(int len)
throws java.io.IOException
- Throws:
java.io.IOException
reset
public void reset()
toBuffer
public Buffer toBuffer()
toByteArray
public byte[] toByteArray()
size
public int size()
Copyright © 2011 Apache Software Foundation. All Rights Reserved.