public abstract class Asn1EncodeByteBuffer extends Asn1EncodeBuffer
Modifier and Type | Field and Description |
---|---|
protected int |
mByteIndex |
protected byte[] |
mData |
INITIAL_SIZE
context, mTypeCode
Constructor and Description |
---|
Asn1EncodeByteBuffer()
The default constructor initializes the encode buffer to the default
buffer size (INITIAL_SIZE bytes).
|
Asn1EncodeByteBuffer(int size)
This constructor allows specification of the initial size.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkSize(int bytesRequired)
This method determines if the encode buffer can hold the requested
number of bytes.
|
void |
copy(byte value)
This method is used to copy a single byte to the encode buffer.
|
void |
copy(byte[] value)
This method copies multiple bytes to the encode buffer.
|
void |
copy(byte[] value,
int off,
int len)
This method copies multiple bytes to the encode buffer.
|
protected void |
copyUnsafe(byte value)
This method is used to copy a single byte to the encode buffer, without
checking whether there is room or not.
|
byte[] |
getBuffer()
This method returns a reference to the byte buffer used to hold
the encoded message.
|
java.io.ByteArrayInputStream |
getByteArrayInputStream()
This method returns a reference to a byte array input stream
representing the encoded message.
|
byte[] |
getMsgCopy()
This method returns the encoded message in a byte array.
|
int |
getMsgLength()
This method returns the length (in bytes) of the encoded
message component.
|
protected void |
initBuffer(int size) |
void |
reset()
This method resets the buffer to allow a new record to be encoded
into it.
|
void |
write(java.io.OutputStream out)
This method writes the encoded record to the given output stream.
|
binDump, binDump, encodeIntSigned, encodeIntUnsigned, getInputStream, getMinimalOctetsSigned, getMinimalOctetsUnsigned, getOutputStream, hexDump, hexDump
addNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerList
getContext, hexDump, hexDump, setKey, setTypeCode
public Asn1EncodeByteBuffer()
public Asn1EncodeByteBuffer(int size)
size
- initial Buffer sizeprotected void checkSize(int bytesRequired)
bytesRequired
- Number of required bytes.public void copy(byte value)
copy
in class Asn1EncodeBuffer
value
- The byte value to copypublic void copy(byte[] value) throws Asn1Exception
copy
in class Asn1EncodeBuffer
value
- Array of bytes to copy to the encode bufferAsn1Exception
public void copy(byte[] value, int off, int len) throws Asn1Exception
copy
in class Asn1EncodeBuffer
value
- Array of bytes to copy to the encode bufferoff
- Starting offset in arraylen
- The length to be encodedAsn1Exception
protected void copyUnsafe(byte value)
value
- The byte value to copypublic java.io.ByteArrayInputStream getByteArrayInputStream()
getByteArrayInputStream
in class Asn1EncodeBuffer
public byte[] getBuffer()
public final byte[] getMsgCopy()
getMsgCopy
in class Asn1EncodeBuffer
public int getMsgLength()
Asn1EncodeBuffer
getMsgLength
in class Asn1EncodeBuffer
protected void initBuffer(int size)
public void reset()
Asn1EncodeBuffer
reset
in class Asn1EncodeBuffer
public final void write(java.io.OutputStream out) throws java.io.IOException
write
in class Asn1EncodeBuffer
out
- Output stream to which record is to be writtenjava.io.IOException
- for any I/O error.