Package org.forgerock.opendj.io
Class Asn1
java.lang.Object
org.forgerock.opendj.io.Asn1
This class contains various static factory methods for creating ASN.1 readers
and writers.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Asn1ReadergetReader(byte[] array) Returns an ASN.1 reader whose source is the provided byte array and having an unlimited maximum BER element size.static Asn1ReadergetReader(byte[] array, int maxElementSize) Returns an ASN.1 reader whose source is the provided byte array and having a user defined maximum BER element size.static Asn1ReadergetReader(InputStream stream) Returns an ASN.1 reader whose source is the provided input stream and having an unlimited maximum BER element size.static Asn1ReadergetReader(InputStream stream, int maxElementSize) Returns an ASN.1 reader whose source is the provided input stream and having a user defined maximum BER element size.static Asn1ReadergetReader(ByteString bytes) Returns an ASN.1 reader whose source is the provided byte string and having an unlimited maximum BER element size.static Asn1ReadergetReader(ByteString bytes, int maxElementSize) Returns an ASN.1 reader whose source is the provided byte string and having a user defined maximum BER element size.static Asn1ReadergetReader(ByteStringReader reader) Returns an ASN.1 reader whose source is the provided byte string reader and having an unlimited maximum BER element size.static Asn1ReadergetReader(ByteStringReader reader, int maxElementSize) Returns an ASN.1 reader whose source is the provided byte string reader and having a user defined maximum BER element size.static Asn1WriterReturns an ASN.1 writer with an initial capacity of 32 bytes.static Asn1WritergetWriter(int initialCapacity) Returns an ASN.1 writer with the provided initial capacity.static ByteStringwriteAsn1Sequence(Consumer<Asn1Writer> sequenceWriter) Writes an ASN.1 sequence using the providedConsumerand returns the encoded bytes.
-
Method Details
-
getReader
Returns an ASN.1 reader whose source is the provided byte array and having an unlimited maximum BER element size.- Parameters:
array- The byte array to use.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided byte array and having a user defined maximum BER element size.- Parameters:
array- The byte array to use.maxElementSize- The maximum BER element size, or0to indicate that there is no limit.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided byte string and having an unlimited maximum BER element size.- Parameters:
bytes- The byte string to use.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided byte string and having a user defined maximum BER element size.- Parameters:
bytes- The byte string to use.maxElementSize- The maximum BER element size, or0to indicate that there is no limit.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided byte string reader and having an unlimited maximum BER element size.- Parameters:
reader- The byte string reader to use.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided byte string reader and having a user defined maximum BER element size.- Parameters:
reader- The byte string reader to use.maxElementSize- The maximum BER element size, or0to indicate that there is no limit.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided input stream and having an unlimited maximum BER element size.- Parameters:
stream- The input stream to use.- Returns:
- The new ASN.1 reader.
-
getReader
Returns an ASN.1 reader whose source is the provided input stream and having a user defined maximum BER element size.- Parameters:
stream- The input stream to use.maxElementSize- The maximum BER element size, or0to indicate that there is no limit.- Returns:
- The new ASN.1 reader.
-
getWriter
Returns an ASN.1 writer with an initial capacity of 32 bytes.- Returns:
- The new ASN.1 writer.
-
getWriter
Returns an ASN.1 writer with the provided initial capacity.- Parameters:
initialCapacity- The initial capacity of the internal byte buffer.- Returns:
- The new ASN.1 writer.
-
writeAsn1Sequence
Writes an ASN.1 sequence using the providedConsumerand returns the encoded bytes.- Parameters:
sequenceWriter- A consumer which is responsible for writing the contents of the sequence to the provided ASN.1 writer. AnyIOExceptions thrown by the consumer will be treated as runtime errors.- Returns:
- The encoded ASN.1 sequence.
-