pasn.misc.encoding
Class TLV_OutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
pasn.encoding.ASN1OutputStream
pasn.misc.encoding.TLV_OutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
- Direct Known Subclasses:
- BEROutputStream, CEROutputStream, DEROutputStream
public abstract class TLV_OutputStream
- extends ASN1OutputStream
- Author:
- ncottin
Field Summary |
static byte[] |
INDEFINITE_LENGTH_END
Indefinite length end-of-content (refers to an empty [UNIVERSAL 0]
object, encoded as 0x00 0x00)
|
Method Summary |
void |
encode(ASN1ConstructedObject asn,
boolean optional)
|
void |
encode(ASN1MandatoryComponent comp,
boolean optional)
|
void |
encode(ASN1PrimitiveObject asn,
boolean optional)
|
void |
encode(ASN1TaggedObject asn,
boolean optional)
|
void |
encode(ASN1TransparentObject asn,
boolean optional)
|
abstract int |
getMaximumPrimitiveSize()
|
abstract boolean |
isConstructedIndefiniteLength()
|
boolean |
isIndefiniteLength(ASN1TaggedObject asn)
|
abstract boolean |
isOrdered()
Indicates whether this ASN.1 outut stream takes care of ASN.1 unordered
structured types (SET, SET OF) inner elements ordering. |
abstract boolean |
isPrimitiveIndefiniteLength()
|
abstract void |
sort(ASN1ConstructedObject asn,
java.util.LinkedList<ASN1IndexedEncodedValue> encodedValues)
|
static void |
writeTag(int tag,
ASN1Class asnClass,
boolean primitive,
java.io.OutputStream out)
|
static void |
writeType(int type,
boolean primitive,
java.io.OutputStream out)
|
static void |
writeTypeOrTag(ASN1MandatoryComponent comp,
java.io.OutputStream out)
|
Methods inherited from class java.io.FilterOutputStream |
close, flush, write, write, write |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INDEFINITE_LENGTH_END
public static final byte[] INDEFINITE_LENGTH_END
Indefinite length end-of-content (refers to an empty [UNIVERSAL 0]
object, encoded as 0x00 0x00)
TLV_OutputStream
public TLV_OutputStream(ASN1ValueEncoder encoder)
TLV_OutputStream
public TLV_OutputStream(java.io.OutputStream out,
ASN1ValueEncoder encoder)
getMaximumPrimitiveSize
public abstract int getMaximumPrimitiveSize()
writeTypeOrTag
public static final void writeTypeOrTag(ASN1MandatoryComponent comp,
java.io.OutputStream out)
throws java.io.IOException,
ASN1EncodingException
- Throws:
java.io.IOException
ASN1EncodingException
writeType
public static final void writeType(int type,
boolean primitive,
java.io.OutputStream out)
throws java.io.IOException,
ASN1EncodingException
- Throws:
java.io.IOException
ASN1EncodingException
writeTag
public static void writeTag(int tag,
ASN1Class asnClass,
boolean primitive,
java.io.OutputStream out)
throws java.io.IOException,
ASN1EncodingException
- Throws:
java.io.IOException
ASN1EncodingException
encode
public final void encode(ASN1PrimitiveObject asn,
boolean optional)
throws java.io.IOException,
ASN1EncodingException
- Specified by:
encode
in class ASN1OutputStream
- Throws:
java.io.IOException
ASN1EncodingException
encode
public final void encode(ASN1ConstructedObject asn,
boolean optional)
throws java.io.IOException,
ASN1EncodingException
- Specified by:
encode
in class ASN1OutputStream
- Throws:
java.io.IOException
ASN1EncodingException
encode
public final void encode(ASN1TaggedObject asn,
boolean optional)
throws java.io.IOException,
ASN1EncodingException
- Specified by:
encode
in class ASN1OutputStream
- Throws:
java.io.IOException
ASN1EncodingException
encode
public final void encode(ASN1MandatoryComponent comp,
boolean optional)
throws java.io.IOException,
ASN1EncodingException
- Specified by:
encode
in class ASN1OutputStream
- Throws:
java.io.IOException
ASN1EncodingException
encode
public final void encode(ASN1TransparentObject asn,
boolean optional)
throws java.io.IOException,
ASN1EncodingException
- Specified by:
encode
in class ASN1OutputStream
- Throws:
java.io.IOException
ASN1EncodingException
isPrimitiveIndefiniteLength
public abstract boolean isPrimitiveIndefiniteLength()
- Returns:
- True if an indefinite length encoding is requested,
false otherwise
isConstructedIndefiniteLength
public abstract boolean isConstructedIndefiniteLength()
- Returns:
- True if an indefinite length encoding is requested,
false otherwise
isIndefiniteLength
public final boolean isIndefiniteLength(ASN1TaggedObject asn)
isOrdered
public abstract boolean isOrdered()
Indicates whether this ASN.1 outut stream takes care of ASN.1 unordered
structured types (SET, SET OF) inner elements ordering. Typically, BER
must return false and DER must return true
- Returns:
- True when SET and SET OF inner elements must be sorted
and false if the encoding rules do not need to sort unordered
structured types inner elements
sort
public abstract void sort(ASN1ConstructedObject asn,
java.util.LinkedList<ASN1IndexedEncodedValue> encodedValues)
throws java.io.IOException,
ASN1EncodingException
- Throws:
java.io.IOException
ASN1EncodingException