Package org.forgerock.opendj.io
Class AbstractAsn1Writer
- java.lang.Object
-
- org.forgerock.opendj.io.AbstractAsn1Writer
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,Asn1Writer
public abstract class AbstractAsn1Writer extends Object implements Asn1Writer
An abstractASN1Writer
which can be used as the basis for implementing new ASN1 writer implementations.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAsn1Writer()
Creates a new abstract ASN.1 writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Asn1Writer
writeBigInteger(byte type, BigInteger value)
Writes an integer element from the providedBigInteger
using the provided type tag.Asn1Writer
writeBigInteger(BigInteger value)
Writes an integer element from the providedBigInteger
value using the Universal Integer ASN.1 type tag.Asn1Writer
writeBoolean(boolean value)
Writes a boolean element using the Universal Boolean ASN.1 type tag.Asn1Writer
writeEndExplicitTag()
Finishes writing elements within the explicit tag.Asn1Writer
writeEnumerated(int value)
Writes an enumerated element using the Universal Enumerated ASN.1 type tag.Asn1Writer
writeInteger(int value)
Writes an integer element using the Universal Integer ASN.1 type tag.Asn1Writer
writeInteger(long value)
Writes an integer element using the Universal Integer ASN.1 type tag.Asn1Writer
writeNull()
Writes a null element using the Universal Null ASN.1 type tag.Asn1Writer
writeOctetString(byte[] value)
Writes an octet string element using the Universal Octet String ASN.1 type tag.Asn1Writer
writeOctetString(byte[] value, int offset, int length)
Writes an octet string element using the Universal Octet String ASN.1 type tag.Asn1Writer
writeOctetString(byte type, byte[] value)
Writes an octet string element using the provided type tag.Asn1Writer
writeOctetString(CharSequence value)
Writes a string as a UTF-8 encoded octet string element using the Universal Octet String ASN.1 type tag.Asn1Writer
writeOctetString(ByteSequence value)
Writes an octet string element using the Universal Octet String ASN.1 type tag.Asn1Writer
writeStartExplicitTag(byte type)
Writes an explicit tag element.Asn1Writer
writeStartSequence()
Writes a sequence element using the Universal Sequence ASN.1 type tag.Asn1Writer
writeStartSet()
Writes a set element using the Universal Set ASN.1 type tag.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.forgerock.opendj.io.Asn1Writer
close, flush, writeAsn1Element, writeAsn1Element, writeAsn1Element, writeBoolean, writeEndSequence, writeEndSet, writeEnumerated, writeInteger, writeInteger, writeNull, writeOctetString, writeOctetString, writeOctetString, writeStartSequence, writeStartSet
-
-
-
-
Method Detail
-
writeBoolean
public Asn1Writer writeBoolean(boolean value) throws IOException
Description copied from interface:Asn1Writer
Writes a boolean element using the Universal Boolean ASN.1 type tag.- Specified by:
writeBoolean
in interfaceAsn1Writer
- Parameters:
value
- The boolean value.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeEnumerated
public Asn1Writer writeEnumerated(int value) throws IOException
Description copied from interface:Asn1Writer
Writes an enumerated element using the Universal Enumerated ASN.1 type tag.- Specified by:
writeEnumerated
in interfaceAsn1Writer
- Parameters:
value
- The enumerated value.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeInteger
public Asn1Writer writeInteger(int value) throws IOException
Description copied from interface:Asn1Writer
Writes an integer element using the Universal Integer ASN.1 type tag.- Specified by:
writeInteger
in interfaceAsn1Writer
- Parameters:
value
- The integer value.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeInteger
public Asn1Writer writeInteger(long value) throws IOException
Description copied from interface:Asn1Writer
Writes an integer element using the Universal Integer ASN.1 type tag.- Specified by:
writeInteger
in interfaceAsn1Writer
- Parameters:
value
- The integer value.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeBigInteger
public Asn1Writer writeBigInteger(BigInteger value) throws IOException
Description copied from interface:Asn1Writer
Writes an integer element from the providedBigInteger
value using the Universal Integer ASN.1 type tag.- Specified by:
writeBigInteger
in interfaceAsn1Writer
- Parameters:
value
- TheBigInteger
to be written.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeBigInteger
public Asn1Writer writeBigInteger(byte type, BigInteger value) throws IOException
Description copied from interface:Asn1Writer
Writes an integer element from the providedBigInteger
using the provided type tag.- Specified by:
writeBigInteger
in interfaceAsn1Writer
- Parameters:
type
- The type tag of the element.value
- TheBigInteger
to be written.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeNull
public Asn1Writer writeNull() throws IOException
Description copied from interface:Asn1Writer
Writes a null element using the Universal Null ASN.1 type tag.- Specified by:
writeNull
in interfaceAsn1Writer
- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeOctetString
public Asn1Writer writeOctetString(byte type, byte[] value) throws IOException
Description copied from interface:Asn1Writer
Writes an octet string element using the provided type tag.- Specified by:
writeOctetString
in interfaceAsn1Writer
- Parameters:
type
- The type tag of the element.value
- The byte array containing the octet string data.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeOctetString
public Asn1Writer writeOctetString(byte[] value) throws IOException
Description copied from interface:Asn1Writer
Writes an octet string element using the Universal Octet String ASN.1 type tag.- Specified by:
writeOctetString
in interfaceAsn1Writer
- Parameters:
value
- The byte array containing the octet string data.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeOctetString
public Asn1Writer writeOctetString(byte[] value, int offset, int length) throws IOException
Description copied from interface:Asn1Writer
Writes an octet string element using the Universal Octet String ASN.1 type tag.- Specified by:
writeOctetString
in interfaceAsn1Writer
- Parameters:
value
- The byte array containing the octet string data.offset
- The offset in the byte array.length
- The number of bytes to write.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeOctetString
public Asn1Writer writeOctetString(ByteSequence value) throws IOException
Description copied from interface:Asn1Writer
Writes an octet string element using the Universal Octet String ASN.1 type tag.- Specified by:
writeOctetString
in interfaceAsn1Writer
- Parameters:
value
- The octet string value.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeOctetString
public Asn1Writer writeOctetString(CharSequence value) throws IOException
Description copied from interface:Asn1Writer
Writes a string as a UTF-8 encoded octet string element using the Universal Octet String ASN.1 type tag.- Specified by:
writeOctetString
in interfaceAsn1Writer
- Parameters:
value
- The string to be written as a UTF-8 encoded octet string.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeStartSequence
public Asn1Writer writeStartSequence() throws IOException
Description copied from interface:Asn1Writer
Writes a sequence element using the Universal Sequence ASN.1 type tag. All further writes will append elements to the sequence untilAsn1Writer.writeEndSequence()
is called.- Specified by:
writeStartSequence
in interfaceAsn1Writer
- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeStartSet
public Asn1Writer writeStartSet() throws IOException
Description copied from interface:Asn1Writer
Writes a set element using the Universal Set ASN.1 type tag. All further writes will append elements to the set untilAsn1Writer.writeEndSet()
is called.- Specified by:
writeStartSet
in interfaceAsn1Writer
- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeStartExplicitTag
public Asn1Writer writeStartExplicitTag(byte type) throws IOException
Description copied from interface:Asn1Writer
Writes an explicit tag element. Once the value for the tag is written, callAsn1Writer.writeEndExplicitTag()
.- Specified by:
writeStartExplicitTag
in interfaceAsn1Writer
- Parameters:
type
- The type tag of the element.- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
writeEndExplicitTag
public Asn1Writer writeEndExplicitTag() throws IOException
Description copied from interface:Asn1Writer
Finishes writing elements within the explicit tag.- Specified by:
writeEndExplicitTag
in interfaceAsn1Writer
- Returns:
- A reference to this ASN.1 writer.
- Throws:
IOException
- If an error occurs while writing the element.
-
-