public interface Asn1Reader extends Closeable
Methods for creating Asn1Reader
s are provided in the Asn1
class.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this ASN.1 reader.
|
boolean |
elementAvailable()
Indicates whether the next element can be read without blocking.
|
boolean |
hasNextElement()
Indicates whether the current stream, sequence, or set contains
another element.
|
int |
peekLength()
Returns the data length of the next element without actually reading it.
|
byte |
peekType()
Returns the type of the next element without actually reading it.
|
boolean |
readBoolean()
Reads the next element as a boolean having the Universal Boolean ASN.1
type tag.
|
boolean |
readBoolean(byte type)
Reads the next element as a boolean having the provided type tag.
|
void |
readEndExplicitTag()
Finishes reading an explicit tag and discards any unread elements.
|
void |
readEndSequence()
Finishes reading a sequence and discards any unread elements.
|
void |
readEndSet()
Finishes reading a set and discards any unread elements.
|
int |
readEnumerated()
Reads the next element as an enumerated having the Universal Enumerated
ASN.1 type tag.
|
int |
readEnumerated(byte type)
Reads the next element as an enumerated having the provided type tag.
|
long |
readInteger()
Reads the next element as an integer having the Universal Integer ASN.1
type tag.
|
long |
readInteger(byte type)
Reads the next element as an integer having the provided type tag.
|
void |
readNull()
Reads the next element as a null element having the Universal Null ASN.1
type tag.
|
void |
readNull(byte type)
Reads the next element as a null element having the provided type tag.
|
ByteString |
readOctetString()
Reads the next element as an octet string having the Universal Octet
String ASN.1 type tag.
|
ByteString |
readOctetString(byte type)
Reads the next element as an octet string having the provided type tag.
|
ByteStringBuilder |
readOctetString(byte type,
ByteStringBuilder builder)
Reads the next element as an octet string having the provided type tag
and appends it to the provided
ByteStringBuilder . |
ByteStringBuilder |
readOctetString(ByteStringBuilder builder)
Reads the next element as an octet string having the Universal Octet
String ASN.1 type tag and appends it to the provided
ByteStringBuilder . |
String |
readOctetStringAsString()
Reads the next element as an octet string having the Universal Octet
String ASN.1 type tag and decodes the value as a UTF-8 encoded string.
|
String |
readOctetStringAsString(byte type)
Reads the next element as an octet string having the provided type tag
and decodes the value as a UTF-8 encoded string.
|
void |
readStartExplicitTag()
Reads the next element as an explicit ignoring the ASN.1 type tag.
|
void |
readStartExplicitTag(byte type)
Reads the next element as an explicit tag having the provided tag type.
|
void |
readStartSequence()
Reads the next element as a sequence having the Universal Sequence ASN.1
type tag.
|
void |
readStartSequence(byte type)
Reads the next element as a sequence having the provided type tag.
|
void |
readStartSet()
Reads the next element as a set having the Universal Set ASN.1 type tag.
|
void |
readStartSet(byte type)
Reads the next element as a set having the provided type tag.
|
Asn1Reader |
skipElement()
Skips the next element without decoding it.
|
Asn1Reader |
skipElement(byte type)
Skips the next element having the provided type tag without decoding it.
|
void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
IOException
- If an error occurs while closing.boolean elementAvailable() throws IOException
true
if a complete element is available or false
otherwise.DecodeException
- If the available data was not valid ASN.1.IOException
- If an unexpected IO error occurred.boolean hasNextElement() throws IOException
true
even if a
previous call to elementAvailable()
returned false
,
indicating that the current set or sequence contains another element but
an attempt to read that element may block. This method will block if
there is not enough data available to make the determination (typically
only the next element's type is required).true
if the current stream, sequence, or set contains
another element, or false
if the end of the stream,
sequence, or set has been reached.DecodeException
- If the available data was not valid ASN.1.IOException
- If an unexpected IO error occurred.int peekLength() throws IOException
-1
if the end of
the stream, sequence, or set has been reached.DecodeException
- If the available data was not valid ASN.1.IOException
- If an unexpected IO error occurred.byte peekType() throws IOException
-1
if the end of the
stream, sequence, or set has been reached.DecodeException
- If the available data was not valid ASN.1.IOException
- If an unexpected IO error occurred.boolean readBoolean() throws IOException
DecodeException
- If the element cannot be decoded as a boolean.IOException
- If an unexpected IO error occurred.boolean readBoolean(byte type) throws IOException
type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as a boolean.IOException
- If an unexpected IO error occurred.void readEndSequence() throws IOException
DecodeException
- If an error occurs while advancing to the end of the
sequence.IOException
- If an unexpected IO error occurred.IllegalStateException
- If there is no sequence being read.void readEndExplicitTag() throws IOException
DecodeException
- If an error occurs while advancing to the end of the
explicit tag.IOException
- If an unexpected IO error occurred.IllegalStateException
- If there is no explicit tag being read.void readEndSet() throws IOException
DecodeException
- If an error occurs while advancing to the end of the set.IOException
- If an unexpected IO error occurred.IllegalStateException
- If there is no set being read.int readEnumerated() throws IOException
DecodeException
- If the element cannot be decoded as an enumerated value.IOException
- If an unexpected IO error occurred.int readEnumerated(byte type) throws IOException
type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as an enumerated value.IOException
- If an unexpected IO error occurred.long readInteger() throws IOException
DecodeException
- If the element cannot be decoded as an integer.IOException
- If an unexpected IO error occurred.long readInteger(byte type) throws IOException
type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as an integer.IOException
- If an unexpected IO error occurred.void readNull() throws IOException
DecodeException
- If the element cannot be decoded as a null element.IOException
- If an unexpected IO error occurred.void readNull(byte type) throws IOException
type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as a null element.IOException
- If an unexpected IO error occurred.ByteString readOctetString() throws IOException
ByteString
.DecodeException
- If the element cannot be decoded as an octet string.IOException
- If an unexpected IO error occurred.ByteString readOctetString(byte type) throws IOException
type
- The expected type tag of the element.ByteString
.DecodeException
- If the element cannot be decoded as an octet string.IOException
- If an unexpected IO error occurred.ByteStringBuilder readOctetString(byte type, ByteStringBuilder builder) throws IOException
ByteStringBuilder
.type
- The expected type tag of the element.builder
- The ByteStringBuilder
to append the octet string to.builder
.DecodeException
- If the element cannot be decoded as an octet string.IOException
- If an unexpected IO error occurred.ByteStringBuilder readOctetString(ByteStringBuilder builder) throws IOException
ByteStringBuilder
.builder
- The ByteStringBuilder
to append the octet string to.builder
.DecodeException
- If the element cannot be decoded as an octet string.IOException
- If an unexpected IO error occurred.String readOctetStringAsString() throws IOException
DecodeException
- If the element cannot be decoded as an octet string.IOException
- If an unexpected IO error occurred.String readOctetStringAsString(byte type) throws IOException
type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as an octet string.IOException
- If an unexpected IO error occurred.void readStartSequence() throws IOException
readEndSequence()
is called.DecodeException
- If the element cannot be decoded as a sequence.IOException
- If an unexpected IO error occurred.void readStartExplicitTag() throws IOException
readEndExplicitTag()
is called.DecodeException
- If the element cannot be decoded as an explicit tag.IOException
- If an unexpected IO error occurred.void readStartExplicitTag(byte type) throws IOException
readEndExplicitTag()
is called.type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as an explicit tag.IOException
- If an unexpected IO error occurred.void readStartSequence(byte type) throws IOException
readEndSequence()
is called.type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as a sequence.IOException
- If an unexpected IO error occurred.void readStartSet() throws IOException
readEndSet()
is called.DecodeException
- If the element cannot be decoded as a set.IOException
- If an unexpected IO error occurred.void readStartSet(byte type) throws IOException
readEndSet()
is
called.type
- The expected type tag of the element.DecodeException
- If the element cannot be decoded as a set.IOException
- If an unexpected IO error occurred.Asn1Reader skipElement() throws IOException
DecodeException
- If the next element could not be skipped.IOException
- If an unexpected IO error occurred.Asn1Reader skipElement(byte type) throws IOException
type
- The expected type tag of the element.DecodeException
- If the next element does not have the provided type tag.IOException
- If an unexpected IO error occurred.Copyright 2010-2022 ForgeRock AS.