public abstract class Asn1EncodeBuffer extends Asn1MessageBuffer
Modifier and Type | Field and Description |
---|---|
static int |
INITIAL_SIZE
This constant specifies the default initial size of the encode buffer.
|
context, mTypeCode
Constructor and Description |
---|
Asn1EncodeBuffer() |
Modifier and Type | Method and Description |
---|---|
abstract void |
binDump(java.io.PrintStream out,
java.lang.String varName)
This method dumps the encoded message in a human-readable format
showing a bit trace of all fields to the given print output stream.
|
void |
binDump(java.lang.String varName)
This method invokes an overloaded version of binDump to dump
the encoded message to standard output.
|
abstract void |
copy(byte value)
This abstract 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
|
abstract void |
copy(byte[] value,
int offset,
int len)
This method copies multiple bytes from the given array to the encode
buffer.
|
static int |
encodeIntSigned(long value,
byte[] dest,
int offset)
Encode an integer value as a signed value (2's complement), in the
minimum number of octets possible (>=1), into the given array.
|
static int |
encodeIntUnsigned(long value,
byte[] dest,
int offset)
Encode an integer value as an unsigned value (binary integer), in the
minimum number of octets possible (>=1), into the given array.
|
abstract java.io.ByteArrayInputStream |
getByteArrayInputStream()
This method returns a reference to a byte array input stream
representing the encoded message.
|
java.io.InputStream |
getInputStream()
This method returns an input stream representing the encoded message.
|
static int |
getMinimalOctetsSigned(long value)
Return the minimal number of octets required to represent the
given value, when a signed representation is being used.
|
static int |
getMinimalOctetsUnsigned(long value)
Return the minimal number of octets required to represent the
given value, when an unsigned representation is being used.
|
abstract byte[] |
getMsgCopy()
This method returns the encoded message in a byte array.
|
abstract int |
getMsgLength()
This method returns the length (in bytes) of the encoded
message component.
|
java.io.OutputStream |
getOutputStream()
Return an output stream associated with this object.
|
void |
hexDump()
This method dumps the encoded message in hex/ascii format to
the standard output stream.
|
void |
hexDump(java.io.PrintStream out)
This method dumps the encoded message in hex/ascii format to
the given print output stream.
|
abstract void |
reset()
This method resets the buffer to allow a new record to be encoded
into it.
|
abstract void |
write(java.io.OutputStream out)
This method writes the encoded record to the given output stream.
|
addNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerList
getContext, hexDump, hexDump, setKey, setTypeCode
public static final int INITIAL_SIZE
public void binDump(java.lang.String varName)
varName
- Variable name to include in output.public abstract void binDump(java.io.PrintStream out, java.lang.String varName)
out
- stream to print to.varName
- Variable name to include in output.public abstract void copy(byte value)
value
- The byte value to copypublic void copy(byte[] value) throws Asn1Exception
value
- Array of bytes to copy to the encode bufferAsn1Exception
public abstract void copy(byte[] value, int offset, int len) throws Asn1Exception
value
- The bytes to be encoded.offset
- The first byte copied is value[offset]len
- The last byte copied is value[offset + len - 1]Asn1Exception
public static int encodeIntSigned(long value, byte[] dest, int offset)
value
- The value to encode.dest
- The array to but the encoding into. It must be large
enough to hold the result, taking into account the given
offset.offset
- The index where the first byte should go.public static int encodeIntUnsigned(long value, byte[] dest, int offset)
value
- The value to encode. It must be non-negative.dest
- The array to but the encoding into. It must be large
enough to hold the result, taking into account the given
offset.offset
- The index where the first byte should go.public abstract java.io.ByteArrayInputStream getByteArrayInputStream()
public final java.io.InputStream getInputStream()
getInputStream
in class Asn1MessageBuffer
public final java.io.OutputStream getOutputStream()
public static int getMinimalOctetsSigned(long value)
value
- The value to determine the minimal octets for.public static int getMinimalOctetsUnsigned(long value)
value
- Must be >=0public abstract byte[] getMsgCopy()
public abstract int getMsgLength()
public void hexDump()
public void hexDump(java.io.PrintStream out)
out
- Output stream object referencepublic abstract void reset()
public abstract void write(java.io.OutputStream out) throws java.io.IOException
out
- Output stream to which record is to be writtenjava.io.IOException
- for any I/O error.