public class DERBuffer extends Object
Pack/unpack objects from a ASN.1 DER encoded blob.
Constructor and Description |
---|
DERBuffer()
Default constructor
|
DERBuffer(byte[] buf)
Create a data buffer to read data from
|
DERBuffer(byte[] buf,
int off,
int len)
Create a data buffer to read data from
|
DERBuffer(int siz)
Create a data buffer to write data to
|
Modifier and Type | Method and Description |
---|---|
int |
calculateLengthBytes(int len)
Calculate the number of length bytes required for a data length
|
int |
getAvailableLength()
Return the available data length
|
byte[] |
getBuffer()
Return the data buffer
|
byte[] |
getBytes()
Return the used buffer as a byte array
|
int |
getLength()
Return the data length
|
int |
getLengthInWords()
Return the data length in words
|
int |
getPosition()
Return the data position
|
void |
packApplicationSpecific(byte[] byts)
Pack an application specific object
|
void |
packApplicationSpecific(DERObject derObj)
Pack an application specific object
|
void |
packApplicationSpecific(int tagId,
byte[] byts)
Pack an application specific object
|
void |
packApplicationSpecific(int tagId,
DERObject derObj)
Pack an application specific object
|
void |
packApplicationSpecific(int tagId,
List derList)
Pack an application specific list of objects
|
void |
packApplicationSpecific(List derList)
Pack an application specific list of objects
|
void |
packByte(int bval)
Append a byte value to the buffer
|
void |
packByteAt(int pos,
int bval)
Pack a byte at the specified position
|
void |
packBytes(byte[] buf,
int off,
int len)
Pack bytes into the buffer
|
void |
packBytes(DERBuffer buf)
Pack bytes from the specified DER buffer into this buffer
|
void |
packInt(int ival)
Pack an integer value
|
void |
packLength(int len)
Pack a data length
|
void |
packLong(long lval)
Pack a long value
|
void |
packObject(DERObject derObj)
Pack an object
|
int |
peekType()
Peek at the next type in the buffer
|
void |
setEndOfBuffer()
Set the end of buffer position, and reset the read position to the beginning of the buffer
|
void |
setLength(int len)
Set the data length
|
void |
setPosition(int pos)
Set the read/write buffer position
|
DERObject |
unpackApplicationSpecific()
Unpack an application specific object
|
byte[] |
unpackApplicationSpecificBytes()
Unpack an application specific blob
|
int |
unpackByte()
Unpack a data byte from the buffer
|
byte[] |
unpackBytes(int len)
Unpack a block of bytes
|
int |
unpackInt(int len)
Unpack an integer value
|
int |
unpackLength()
Unpack a data length value
|
long |
unpackLong(int len)
Unpack a long (64 bit) value
|
DERObject |
unpackObject()
Unpack an object from the buffer
|
int |
unpackType()
Unpack a data type from the buffer
|
public DERBuffer()
public DERBuffer(int siz)
siz
- intpublic DERBuffer(byte[] buf, int off, int len)
buf
- byte[]off
- intlen
- intpublic DERBuffer(byte[] buf)
buf
- byte[]public final byte[] getBuffer()
public final int getLength()
public final int getLengthInWords()
public final int getAvailableLength()
public final int getPosition()
public final byte[] getBytes()
public final int unpackByte()
public final byte[] unpackBytes(int len)
len
- intpublic final int peekType()
public final int unpackType()
public final int unpackLength()
public final DERObject unpackObject() throws IOException
IOException
public final int unpackInt(int len)
len
- intpublic final long unpackLong(int len)
len
- intpublic final void packByte(int bval)
bval
- intpublic final void packByteAt(int pos, int bval)
pos
- intbval
- intpublic final void packBytes(byte[] buf, int off, int len)
buf
- byte[]off
- intlen
- intpublic final void packBytes(DERBuffer buf)
buf
- DERBufferpublic final void packLength(int len)
len
- intpublic final void packInt(int ival)
ival
- intpublic final void packLong(long lval)
lval
- longpublic final void packObject(DERObject derObj) throws IOException
derObj
- DERObjectIOException
public final void packApplicationSpecific(DERObject derObj) throws IOException
derObj
- DERObjectIOException
public final void packApplicationSpecific(int tagId, DERObject derObj) throws IOException
tagId
- intderObj
- DERObjectIOException
public final void packApplicationSpecific(List derList) throws IOException
derList
- ListIOException
public final void packApplicationSpecific(int tagId, List derList) throws IOException
tagId
- intderList
- ListIOException
public final void packApplicationSpecific(int tagId, byte[] byts) throws IOException
tagId
- intbyts
- byte[]IOException
public final void packApplicationSpecific(byte[] byts) throws IOException
byts
- byte[]IOException
public final DERObject unpackApplicationSpecific() throws IOException
IOException
public final byte[] unpackApplicationSpecificBytes() throws IOException
IOException
public final int calculateLengthBytes(int len)
len
- intpublic final void setPosition(int pos)
pos
- intpublic final void setEndOfBuffer()
public final void setLength(int len)
len
- intCopyright © 2005–2018 Alfresco Software. All rights reserved.