codec.asn1
Class ASN1OctetString

java.lang.Object
  |
  +--codec.asn1.ASN1AbstractType
        |
        +--codec.asn1.ASN1OctetString
All Implemented Interfaces:
ASN1Type, Cloneable, Externalizable, Serializable
Direct Known Subclasses:
Data

public class ASN1OctetString
extends ASN1AbstractType

Represents an ASN.1 OCTET STRING type. The corresponding Java type is byte[].

Version:
"$Id: ASN1OctetString.java,v 1.3 2001/01/21 13:46:55 vroth Exp $"
Author:
Volker Roth
See Also:
Serialized Form

Constructor Summary
ASN1OctetString()
           
ASN1OctetString(byte[] b)
          Creates an instance with side effects.
 
Method Summary
 int byteCount()
           
 Object clone()
          Returns a clone.
 void decode(Decoder dec)
           
 void encode(Encoder enc)
           
 byte[] getByteArray()
          Returns the contents octets as a byte array.
 int getTag()
          Returns the corresponding ASN.1 tag.
 Object getValue()
          This abstract method should return the value wrapped by the ASN1Type.
 void setByteArray(byte[] b)
          Sets the given bytes.
 String toString()
           
 
Methods inherited from class codec.asn1.ASN1AbstractType
checkConstraints, getConstraint, getTagClass, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASN1OctetString

public ASN1OctetString()

ASN1OctetString

public ASN1OctetString(byte[] b)
Creates an instance with side effects. The given array is copied by reference.
Parameters:
b - The byte array that is set as contents.
Method Detail

getValue

public Object getValue()
Description copied from class: ASN1AbstractType
This abstract method should return the value wrapped by the ASN1Type.
Overrides:
getValue in class ASN1AbstractType
Following copied from class: codec.asn1.ASN1AbstractType
Returns:
the internal value

getByteArray

public byte[] getByteArray()
Returns the contents octets as a byte array. The returned byte array is is the instance used internally. Do not modify it, otherwise side effects occur.
Returns:
The contents octets as a byte array.

setByteArray

public void setByteArray(byte[] b)
                  throws ConstraintException
Sets the given bytes. The given byte array is copied by reference. Be careful, side effects can occur if the array is modified subsequent to calling this method. Constraints are checked after setting the bytes.
Parameters:
b - The byte array that is set.
Throws:
ConstraintException - if the constraint is not met by the given byte array.

byteCount

public int byteCount()

getTag

public int getTag()
Description copied from class: ASN1AbstractType
Returns the corresponding ASN.1 tag.
Overrides:
getTag in class ASN1AbstractType
Following copied from class: codec.asn1.ASN1AbstractType
Returns:
the corresponding ASN.1 tag

encode

public void encode(Encoder enc)
            throws ASN1Exception,
                   IOException
Overrides:
encode in class ASN1AbstractType

decode

public void decode(Decoder dec)
            throws ASN1Exception,
                   IOException
Overrides:
decode in class ASN1AbstractType

toString

public String toString()
Overrides:
toString in class Object

clone

public Object clone()
Returns a clone. The clone is a deep copy of this instance with the exception of constraints. Constraints are copied by reference.
Overrides:
clone in class Object
Returns:
The clone.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.