public class Asn1PerEncodeBuffer extends Asn1EncodeBitBuffer implements Asn1PerMessageBuffer, Asn1PerEncoder
mByteIndex, mData, mTraceHandlerINITIAL_SIZEcontext, mTypeCode| Constructor and Description |
|---|
Asn1PerEncodeBuffer(boolean aligned)
This constructor creates a PER encode buffer object with the
default initial size.
|
Asn1PerEncodeBuffer(boolean aligned,
int size)
This constructor creates a PER encode buffer object with the
given initial size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
byteAlign()
This method byte-aligns the buffer if the buffer is set
to be aligned.
|
void |
encodeBit(boolean value)
This method encodes a single bit value.
|
void |
encodeBit(boolean value,
java.lang.String ident)
This method encodes a single bit value.
|
void |
encodeBits(byte[] value,
int offset,
int nbits)
This method encodes bit values from an array of octets.
|
void |
encodeBits(byte[] value,
int offset,
int bitOffset,
int nbits)
This method encodes bit values from an array of octets.
|
void |
encodeBits(byte[] value,
int offset,
int bitOffset,
int nbits,
java.lang.String ident)
This method encodes bit values from an array of octets.
|
void |
encodeBits(byte[] value,
int offset,
int nbits,
java.lang.String ident)
This method encodes bit values from an array of octets.
|
void |
encodeCharString(java.lang.String value,
int nchars,
int offset,
int abpc,
int ubpc,
Asn1CharSet charSet)
This method encodes the contents of a known-multiplier character
string type.
|
void |
encodeConsWholeNumber(long adjustedValue,
long rangeValue)
This method implements the rules to encode a constrained whole
number as specified in section 10.5 of the X.691 standard.
|
void |
encodeConsWholeNumber(long adjustedValue,
long rangeValue,
java.lang.String ident)
This method implements the rules to encode a constrained whole
number as specified in section 10.5 of the X.691 standard.
|
void |
encodeInt(long value,
boolean encodeLen,
boolean signExtend)
This method implements the rules to encode either a
non-negative binary integer as specified in section 10.3 or
a two's complement binary integer as specified in section 10.4
of the X.691 standard.
|
void |
encodeInt(long value,
boolean encodeLen,
boolean signExtend,
java.lang.String ident)
This method implements the rules to encode either a
non-negative binary integer as specified in section 10.3 or
a two's complement binary integer as specified in section 10.4
of the X.691 standard.
|
void |
encodeInt(long value,
int nbits)
This method encodes bit values from an integer value.
|
void |
encodeInt(long value,
int nbits,
java.lang.String ident)
This method encodes bit values from an integer value.
|
long |
encodeLength(long value)
This method encodes either a constrained or unconstrained
length depending on whether a size constraint object is set
in this object.
|
void |
encodeLength(long value,
long lower,
long upper)
This method encodes a constrained length determinant value.
|
void |
encodeLengthEOM(long value)
This method checks to see if a zero byte needs to be added
after a fragmented length has been encoded.
|
void |
encodeOctetString(byte[] value,
int offset,
int nbytes)
This method encodes the given array of bytes as an unconstrained
octet string value.
|
void |
encodeOIDLengthAndValue(int[] value)
This method encodes the length and contents of an object
identifier value.
|
void |
encodeOpenType(Asn1PerEncodeBuffer buffer,
java.lang.String elemName)
This overloaded version of encodeOpenType will encode the
componet in the given PER encode buffer into this PER encode
buffer.
|
void |
encodeOpenType(byte[] value,
int offset,
int nbytes)
This method encodes the given array of bytes as an open type.
|
void |
encodeRelOIDLengthAndValue(int[] value)
This method encodes the length and contents of a relative
object identifier value.
|
void |
encodeSmallLength(int value)
This method implements the rules to encode a normally small length
as specified in section 11.9 of the X.691 standard.
|
void |
encodeSmallNonNegWholeNumber(int value)
This method implements the rules to encode a small non-negative
whole number as specified in section 10.6 of the X.691 standard.
|
long |
encodeUnconsLength(long value)
This method encodes a general (unconstrained) length
determinant value as described in section 10.9 or the
X.691 standard.
|
boolean |
isAligned()
This method is used to test if PER aligned encoding has been
specified.
|
void |
setAligned(boolean value)
This method is used to turn PER aligned encoding on or off
|
void |
setSizeConstraint(long lower,
long upper)
This method is used to set a size constraint within the
buffer object.
|
void |
setSizeConstraintExt(long lower,
long upper,
long extLower,
long extUpper)
This method is used to set an extensible size constraint within
the buffer object.
|
binDump, checkSize, copy, copy, encodeBits, encodeLongBits, encodeLongBits, getBitOffsetInByte, getBuffer, getByteArrayInputStream, getByteIndex, getMsgBitCnt, getMsgByteCnt, getMsgCopy, getMsgLength, getTraceHandler, hexDump, isByteAligned, reset, reverseBytes, setMsgBitCnt, toString, write, write, write, writebinDump, copy, encodeIntSigned, encodeIntUnsigned, getInputStream, getMinimalOctetsSigned, getMinimalOctetsUnsigned, getOutputStream, hexDumpaddNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerListgetContext, hexDump, hexDump, setKey, setTypeCodeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetInputStream, getMsgBitCnt, getTraceHandlerencodeBitspublic Asn1PerEncodeBuffer(boolean aligned)
aligned - Indicates whether PER aligned or unaligned encoding
should be done.public Asn1PerEncodeBuffer(boolean aligned,
int size)
aligned - Indicates whether PER aligned or unaligned encoding
should be done.size - The initial size in bytes of an encode buffer.public void byteAlign()
byteAlign in interface Asn1BitMessageBufferbyteAlign in class Asn1EncodeBitBufferpublic void encodeBit(boolean value,
java.lang.String ident)
encodeBit in interface Asn1PerEncodervalue - Boolean value of bit to be encoded.ident - Bit field identifier name for tracing.public void encodeBit(boolean value)
encodeBit in interface Asn1PerEncoderencodeBit in class Asn1EncodeBitBuffervalue - Boolean value of bit to be encoded.public void encodeBits(byte[] value,
int offset,
int nbits,
java.lang.String ident)
throws Asn1InvalidArgException
encodeBits in interface Asn1PerEncodervalue - Octet array containing bits to be encodedoffset - Starting byte offset in valuenbits - Number of bits to encodeident - Bit field identifier name for tracing, or null.Asn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeBits(byte[] value,
int offset,
int bitOffset,
int nbits,
java.lang.String ident)
throws Asn1InvalidArgException
value - Octet array containing bits to be encodedoffset - Starting byte offset in valuebitOffset - Starting bit offset in first byte. Pass 0 to begin
encoding with the most significant bit. Pass 7 to begin with the
least significant bit.nbits - Number of bits to encodeident - Bit field identifier name for tracing, or null.Asn1InvalidArgExceptionpublic void encodeBits(byte[] value,
int offset,
int bitOffset,
int nbits)
encodeBits in class Asn1EncodeBitBuffervalue - Octet array containing bits to be encodedoffset - Starting byte offset in valuebitOffset - Starting bit offset in first byte. Pass 0 to begin
encoding with the most significant bit. Pass 7 to begin with the
least significant bit.nbits - Number of bits to encodepublic void encodeBits(byte[] value,
int offset,
int nbits)
throws Asn1InvalidArgException
encodeBits in interface Asn1PerEncoderencodeBits in class Asn1EncodeBitBuffervalue - Octet array containing bits to be encodedoffset - Starting byte offset in valuenbits - Number of bits to encodeAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeCharString(java.lang.String value,
int nchars,
int offset,
int abpc,
int ubpc,
Asn1CharSet charSet)
throws Asn1Exception
encodeCharString in interface Asn1PerEncodervalue - String containing characters to encodenchars - Number of characters from string to encodeoffset - Offset to first char in string to encodeabpc - Number of bits per character (aligned)ubpc - Number of bits per character (unaligned)charSet - Object representing permitted alphabet
constraint character set (optional)Asn1Exception - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeConsWholeNumber(long adjustedValue,
long rangeValue,
java.lang.String ident)
throws Asn1InvalidArgException
encodeConsWholeNumber in interface Asn1PerEncoderadjustedValue - Adjusted value to be encoded =
value - lower range endpoint value. Negative
values are interpreted as unsigned integers.rangeValue - upper - lower + 1. Negative values are
interpreted as unsigned integers. Zero is
used to represent 2^64.ident - Tracing identifierAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeConsWholeNumber(long adjustedValue,
long rangeValue)
throws Asn1InvalidArgException
encodeConsWholeNumber in interface Asn1PerEncoderadjustedValue - Adjusted value to be encoded =
value - lower range endpoint valuerangeValue - upper - lower + 1. Negative values are
interpreted as unsigned integers. Zero is
used to represent 2^64.Asn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeInt(long value,
int nbits,
java.lang.String ident)
throws Asn1InvalidArgException
encodeInt in interface Asn1PerEncodervalue - Integer containing bits to be encodednbits - Number of bits to encodeident - Tracing identifierAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeInt(long value,
int nbits)
throws Asn1InvalidArgException
encodeInt in interface Asn1PerEncodervalue - Integer containing bits to be encodednbits - Number of bits to encodeAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeInt(long value,
boolean encodeLen,
boolean signExtend,
java.lang.String ident)
throws Asn1InvalidArgException
encodeInt in interface Asn1PerEncodervalue - Integer value to be encodedencodeLen - Flag indicating length determinant should be
encoded before encoding integer value.signExtend - Flag indicating if sign extension should be performed.ident - Tracing identifierAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeInt(long value,
boolean encodeLen,
boolean signExtend)
throws Asn1InvalidArgException
encodeInt in interface Asn1PerEncodervalue - Integer value to be encodedencodeLen - Flag indicating length determinant should be
encoded before encoding integer value.signExtend - Flag indicating if sign extension should be performed.Asn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public long encodeLength(long value)
throws Asn1InvalidArgException
encodeLength in interface Asn1PerEncodervalue - Length value to be encodedAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public long encodeUnconsLength(long value)
throws Asn1InvalidArgException
value - Length value to be encodedAsn1InvalidArgExceptionpublic void encodeLength(long value,
long lower,
long upper)
throws Asn1Exception
encodeLength in interface Asn1PerEncodervalue - Length value to be encodedlower - Lower bound (inclusive) of length value rangeupper - Upper bound (inclusive) of length value rangeAsn1Exception - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeLengthEOM(long value)
encodeLengthEOM in interface Asn1PerEncodervalue - Original length value that was encoded.public void encodeOIDLengthAndValue(int[] value)
throws Asn1Exception
encodeOIDLengthAndValue in interface Asn1PerEncodervalue - Integer array containing arcs to encodeAsn1Exception - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeRelOIDLengthAndValue(int[] value)
throws Asn1Exception
encodeRelOIDLengthAndValue in interface Asn1PerEncodervalue - Integer array containing arcs to encodeAsn1Exception - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeOctetString(byte[] value,
int offset,
int nbytes)
throws Asn1Exception
encodeOctetString in interface Asn1PerEncodervalue - Byte array containing data to encode. This is
assumed to contain a previously encoded PER
component.offset - Starting offset in byte array valuenbytes - Number of bytes to encodeAsn1Exception - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeOpenType(byte[] value,
int offset,
int nbytes)
throws Asn1Exception
encodeOpenType in interface Asn1PerEncodervalue - Byte array containing data to encode. This is
assumed to contain a previously encoded PER
component.offset - Starting offset in byte array valuenbytes - Number of bytes to encodeAsn1Exception - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeOpenType(Asn1PerEncodeBuffer buffer, java.lang.String elemName) throws Asn1Exception
buffer - PER encode buffer containing encoded message
component.elemName - Name of element being encoded.Asn1Exceptionpublic void encodeSmallLength(int value)
throws Asn1InvalidArgException
encodeSmallLength in interface Asn1PerEncodervalue - Value to be encodedAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public void encodeSmallNonNegWholeNumber(int value)
throws Asn1InvalidArgException
encodeSmallNonNegWholeNumber in interface Asn1PerEncodervalue - Value to be encodedAsn1InvalidArgException - Any exception thrown by the underlying
Asn1PerEncodeBuffer.public boolean isAligned()
isAligned in interface Asn1PerMessageBufferpublic void setAligned(boolean value)
public void setSizeConstraint(long lower,
long upper)
lower - Lower bound of root constraintupper - Upper bound of root constraintpublic void setSizeConstraintExt(long lower,
long upper,
long extLower,
long extUpper)
lower - Lower bound of root constraintupper - Upper bound of root constraintextLower - Lower bound of extension constraintextUpper - Upper bound of extension constraint