| |
|
| java.lang.Object java.io.OutputStream org.snmp4j.asn1.BEROutputStream
BEROutputStream | public class BEROutputStream extends OutputStream (Code) | | The BEROutputStream class wraps a ByteBuffer
to support BER encoding. The backing buffer can be accessed directly to
optimize performance and memory usage.
author: Frank Fock version: 1.0 |
Constructor Summary | |
public | BEROutputStream() Creates a BER output stream without a backing buffer set. | public | BEROutputStream(ByteBuffer buffer) Create a BEROutputStream that uses the supplied buffer
as backing buffer. |
Method Summary | |
public void | close() | public void | flush() | public ByteBuffer | getBuffer() Gets the backing buffer. | public ByteBuffer | rewind() Rewinds backing buffer and returns it. | public void | setBuffer(ByteBuffer buffer) Sets the backing buffer to the supplied one and sets the offset used by
BEROutputStream.rewind() to the buffers current position. | public void | setFilledBuffer(ByteBuffer buffer) Sets the backing buffer and sets the current position of the stream to
the buffers limit (end). | public void | write(int b) | public void | write(byte[] b) | public void | write(byte[] b, int off, int len) |
BEROutputStream | public BEROutputStream()(Code) | | Creates a BER output stream without a backing buffer set. In order to
be able to write anything to the stream,
BEROutputStream.setBuffer(ByteBuffer buffer) has to be
called before. Otherwise a NullPointerException will be
thrown when calling one of the write operations.
|
BEROutputStream | public BEROutputStream(ByteBuffer buffer)(Code) | | Create a BEROutputStream that uses the supplied buffer
as backing buffer.
Parameters: buffer - a ByteBuffer whose limit and capacity must be greater orequal that the length of the encoded BER stream. |
getBuffer | public ByteBuffer getBuffer()(Code) | | Gets the backing buffer.
the ByteBuffer backing this output stream. |
rewind | public ByteBuffer rewind()(Code) | | Rewinds backing buffer and returns it. In contrast to the backing buffer's
rewind method, this method sets the position of the buffer to the first
byte of this output stream rather than to the first byte of the underlying
byte array!
the ByteBuffer backing this output stream with its current positionset to the begin of the output stream. |
setBuffer | public void setBuffer(ByteBuffer buffer)(Code) | | Sets the backing buffer to the supplied one and sets the offset used by
BEROutputStream.rewind() to the buffers current position.
Parameters: buffer - a ByteBuffer whose limit and capacity must be greater orequal that the length of the encoded BER stream. |
setFilledBuffer | public void setFilledBuffer(ByteBuffer buffer)(Code) | | Sets the backing buffer and sets the current position of the stream to
the buffers limit (end).
Parameters: buffer - a ByteBuffer whose limit and capacity must be greater orequal that the length of the encoded BER stream. |
|
|
|