|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objsys.asn1j.runtime.Asn1MessageBufferBase com.objsys.asn1j.runtime.Asn1MessageBuffer com.objsys.asn1j.runtime.Asn1EncodeBuffer com.objsys.asn1j.runtime.Asn1BerEncodeBuffer
public class Asn1BerEncodeBuffer
This class handles the encoding of ASN.1 messages as specified in the Basic Encoding Rules (BER) as specified in the ITU-T X.690 standard. A reference to an object of this type is passed to each of the ASN.1 type encode methods involved in encoding a particular message type.
Field Summary |
---|
Fields inherited from class com.objsys.asn1j.runtime.Asn1EncodeBuffer |
---|
INITIAL_SIZE, mByteIndex, mData |
Fields inherited from class com.objsys.asn1j.runtime.Asn1MessageBufferBase |
---|
context, mTypeCode |
Constructor Summary | |
---|---|
Asn1BerEncodeBuffer()
This constructor creates a BER encode buffer object with the default initial size. |
|
Asn1BerEncodeBuffer(int size)
This constructor creates a BER encode buffer object with the given initial size. |
Method Summary | |
---|---|
void |
binDump()
|
void |
binDump(java.io.PrintStream out,
java.lang.String varName)
This method dumps the encoded message in a human-readable format showing tags and contents to the given print output stream. |
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 copies 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 startOffset,
int length)
This method copies multiple bytes to the encode buffer |
void |
copy(java.lang.String value)
This method copies a character string into the encode buffer |
int |
encodeIdentifier(int ident)
This method encodes an ASN.1 identifier value such as the ones used in a tags or object identifiers. |
int |
encodeIntValue(long ivalue)
This method encodes an ASN.1 integer value's contents according to the ASN.1 Basic Encoding Rules (BER).. |
int |
encodeLength(int len)
This method encodes a length value. |
int |
encodeTag(Asn1Tag tag)
This method encodes a tag value. |
int |
encodeTag(short tagClass,
short tagForm,
int tagIdent)
This method encodes a tag value. |
int |
encodeTagAndLength(Asn1Tag tag,
int len)
This method encodes both a tag and length value. |
int |
encodeTagAndLength(short tagClass,
short tagForm,
int tagIDCode,
int len)
This overloaded version of encodeTagAndLength allows tag value components to be specified instead of an Asn1Tag object |
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. |
byte[] |
getMsgCopy()
This method returns the encoded message in a byte array. |
int |
getMsgLength()
This method returns the length of the encoded message component. |
boolean |
isBER()
This method is used for testing encode rules type. |
void |
reset()
This method resets the buffer to allow a new record to be encoded into it. |
java.lang.String |
toString()
This method will return a string representation of the data in the encode buffer. |
void |
write(java.io.OutputStream out)
This method writes the encoded record to the given output stream. |
Methods inherited from class com.objsys.asn1j.runtime.Asn1EncodeBuffer |
---|
binDump, hexDump, hexDump, initBuffer, trimBitString |
Methods inherited from class com.objsys.asn1j.runtime.Asn1MessageBuffer |
---|
addNamedEventHandler, getEventHandlerListCount, hasEventHandlers, invokeCharacters, invokeEndElement, invokeStartElement, setEventHandlerList |
Methods inherited from class com.objsys.asn1j.runtime.Asn1MessageBufferBase |
---|
getContext, hexDump, hexDump, setKey, setTypeCode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Asn1BerEncodeBuffer()
public Asn1BerEncodeBuffer(int size)
size
- The initial size in bytes of an encode buffer.Method Detail |
---|
protected void checkSize(int bytesRequired)
checkSize
in class Asn1EncodeBuffer
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 buffer
Asn1Exception
public void copy(byte[] value, int startOffset, int length) throws Asn1Exception
value
- Array of bytes to copy to the encode buffer
Asn1Exception
public void copy(java.lang.String value)
value
- String to copy to the encode bufferpublic int encodeIdentifier(int ident)
ident
- The identifier to be encoded.
public int encodeIntValue(long ivalue)
ivalue
- Integer value to encode
public int encodeLength(int len)
len
- The length to be encoded.
public int encodeTag(Asn1Tag tag)
tag
- The tag to be encoded.
public int encodeTag(short tagClass, short tagForm, int tagIdent)
tagClass
- Tag class value (UNIV, APPL, CTXT, or PRIV)tagForm
- Tag form value (PRIM or CONS)tagIdent
- Tag identifer code
public int encodeTagAndLength(Asn1Tag tag, int len)
tag
- The tag to be encoded.len
- The length to be encoded.
public int encodeTagAndLength(short tagClass, short tagForm, int tagIDCode, int len)
tagClass
- The class of the tag to be encoded.tagForm
- The form of the tag to be encoded.tagIDCode
- The ID code of the tag to be encoded.len
- The length to be encoded.
public java.io.ByteArrayInputStream getByteArrayInputStream()
public java.io.InputStream getInputStream()
getInputStream
in class Asn1MessageBuffer
public byte[] getMsgCopy()
getMsgCopy
in class Asn1EncodeBuffer
public int getMsgLength()
getMsgLength
in class Asn1EncodeBuffer
public void binDump(java.io.PrintStream out, java.lang.String varName)
binDump
in class Asn1EncodeBuffer
public void binDump()
public void reset()
reset
in class Asn1EncodeBuffer
public java.lang.String toString()
toString
in class java.lang.Object
public void write(java.io.OutputStream out) throws java.io.IOException
write
in class Asn1EncodeBuffer
out
- Output stream to which record is to be written
java.io.IOException
public boolean isBER()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |