org.openmuc.jsml.structures
Class OctetString

java.lang.Object
  extended by org.openmuc.jsml.structures.ASNObject
      extended by org.openmuc.jsml.structures.OctetString
Direct Known Subclasses:
SML_Signature

public class OctetString
extends ASNObject


Field Summary
protected  byte[] octetString
           
 
Fields inherited from class org.openmuc.jsml.structures.ASNObject
isOptional, isSelected
 
Constructor Summary
OctetString()
           
OctetString(byte[] octetString)
           
OctetString(java.lang.String octetString)
           
 
Method Summary
 void code(java.io.DataOutputStream os)
          encodes this object and writes it to the stream os.
 boolean decode(java.io.DataInputStream is)
          decodes the data from the InputStream and writes it to an object
 boolean equals(java.lang.Object other)
          Compares this octet string to the specified object.
 byte[] getOctetString()
           
 int hashCode()
          Returns a hash code for this octet string.
 void print()
          prints the content or type of the object to stdout
 void set(byte[] octetString)
           
static byte[] toArray(java.lang.String octetString)
          Convert octet string to byte array.
 java.lang.String toString()
           
 
Methods inherited from class org.openmuc.jsml.structures.ASNObject
isOptional, isSelected, setOptional, setSelected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

octetString

protected byte[] octetString
Constructor Detail

OctetString

public OctetString(byte[] octetString)

OctetString

public OctetString(java.lang.String octetString)

OctetString

public OctetString()
Method Detail

set

public void set(byte[] octetString)

print

public void print()
Description copied from class: ASNObject
prints the content or type of the object to stdout

Specified by:
print in class ASNObject

code

public void code(java.io.DataOutputStream os)
          throws java.io.IOException
Description copied from class: ASNObject
encodes this object and writes it to the stream os.

Specified by:
code in class ASNObject
Throws:
java.io.IOException - if something went wrong while writing to the stream

decode

public boolean decode(java.io.DataInputStream is)
               throws java.io.IOException
Description copied from class: ASNObject
decodes the data from the InputStream and writes it to an object

Specified by:
decode in class ASNObject
Returns:
true if successfully decoded
Throws:
java.io.IOException - if something went wrong while reading from the stream

getOctetString

public byte[] getOctetString()

hashCode

public int hashCode()
Returns a hash code for this octet string.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Compares this octet string to the specified object.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toArray

public static byte[] toArray(java.lang.String octetString)
Convert octet string to byte array. For example, both strings "test" and "0x74657374" will result in equals byte arrays.