jp.bitmeister.asn1.type.builtin
Class OCTET_STRING

java.lang.Object
  extended by jp.bitmeister.asn1.type.ASN1Type
      extended by jp.bitmeister.asn1.type.PrimitiveType<byte[]>
          extended by jp.bitmeister.asn1.type.builtin.OCTET_STRING
All Implemented Interfaces:
java.lang.Cloneable, Concatenatable<OCTET_STRING>, SizeCountable
Direct Known Subclasses:
StringType

public class OCTET_STRING
extends PrimitiveType<byte[]>
implements Concatenatable<OCTET_STRING>, SizeCountable

Represents ASN.1 'OCTET STRING' type.

An instance of this class represents an 'OCTET STRING' type data, and has an array of byte value.

Author:
WATANABE, Jun.

Field Summary
 
Fields inherited from class jp.bitmeister.asn1.type.ASN1Type
stringBuilder
 
Constructor Summary
OCTET_STRING()
          Instantiates an empty OCTET_STRING.
OCTET_STRING(byte... value)
          Instantiates an OCTET_STRING and initialize it with the array of byte value.
OCTET_STRING(StringItem item)
          Instantiates an OCTET_STRING and initialize it with the StringItem.
 
Method Summary
<R,E extends java.lang.Throwable>
R
accept(ASN1Visitor<R,E> visitor)
          Accepts the ASN1Visitor and calls a visit method of the visitor.
protected  byte[] cloneValue()
          Creates and returns a copy of the value set to this data.
 void concatenate(OCTET_STRING data)
          Appends the value of the data to the value of this instance.
 void set(StringItem item)
          Sets the StringItem value to the instance.
 int size()
          Returns the measured size of this instance.
 boolean valueEquals(java.lang.Object other)
          Tests if the value of this ASN.1 data equals the value of the other ASN.1 data.
 
Methods inherited from class jp.bitmeister.asn1.type.PrimitiveType
clear, clone, hashCode, hasValue, set, value
 
Methods inherited from class jp.bitmeister.asn1.type.ASN1Type
equals, instantiate, matches, specification, toString, validate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OCTET_STRING

public OCTET_STRING()
Instantiates an empty OCTET_STRING.


OCTET_STRING

public OCTET_STRING(byte... value)
Instantiates an OCTET_STRING and initialize it with the array of byte value.

Parameters:
value - The value assigned to the instance.

OCTET_STRING

public OCTET_STRING(StringItem item)
Instantiates an OCTET_STRING and initialize it with the StringItem.

Parameters:
item - The value assigned to the instance.
Method Detail

set

public void set(StringItem item)
Sets the StringItem value to the instance.

Parameters:
item - The value assigned to the instance.

concatenate

public void concatenate(OCTET_STRING data)
Description copied from interface: Concatenatable
Appends the value of the data to the value of this instance.

Specified by:
concatenate in interface Concatenatable<OCTET_STRING>
Parameters:
data - The data that has the value to be appended. The ASN.1 type of the data shall be same as this instance.

size

public int size()
Description copied from interface: SizeCountable
Returns the measured size of this instance.

Specified by:
size in interface SizeCountable
Returns:
The size.

cloneValue

protected byte[] cloneValue()
Description copied from class: PrimitiveType
Creates and returns a copy of the value set to this data.

Overrides:
cloneValue in class PrimitiveType<byte[]>
Returns:
A copy of the value.

valueEquals

public boolean valueEquals(java.lang.Object other)
Description copied from class: ASN1Type
Tests if the value of this ASN.1 data equals the value of the other ASN.1 data. This method returns true when they have same value even if their types are different.

Overrides:
valueEquals in class PrimitiveType<byte[]>
Parameters:
other - The ASN.1 data which to be compared.
Returns:
true when they have same value.

accept

public <R,E extends java.lang.Throwable> R accept(ASN1Visitor<R,E> visitor)
         throws E extends java.lang.Throwable
Description copied from class: ASN1Type
Accepts the ASN1Visitor and calls a visit method of the visitor.

Specified by:
accept in class ASN1Type
Parameters:
visitor - The visitor.
Returns:
Result.
Throws:
E - When an error occured in the visit method of the visitor.
E extends java.lang.Throwable