public class SnmpOctetString extends java.lang.Object implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
ASNTYPE
The ASN.1 value for the OCTET STRING type.
|
private byte[] |
m_data
The actual octet string data (UTF-8)
|
(package private) static long |
serialVersionUID
Required to allow evolution of serialization format.
|
Constructor and Description |
---|
SnmpOctetString()
The default class constructor.
|
SnmpOctetString(byte[] data)
Constructs an octet string with the
inital value equal to data.
|
SnmpOctetString(SnmpOctetString second)
Class copy constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
assumeString(byte[] data)
This can be used by a derived class to force
the data contained by the octet string.
|
java.lang.Object |
clone()
Creates a duplicate copy of the object and
returns it to the caller.
|
int |
decodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Decodes the ASN.1 octet string from the passed buffer.
|
SnmpSyntax |
duplicate()
Creates a duplicate copy of the object and
returns it to the caller.
|
int |
encodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Encodes the ASN.1 octet string using the passed encoder and stores
the results in the passed buffer.
|
int |
getLength()
Returns the internal length of the octet string.
|
byte[] |
getString()
Returns a reference to the internal object string.
|
void |
setString(byte[] data)
Sets the internal string array so that it is
identical to the passed array.
|
void |
setString(java.lang.String data)
Sets the internal octet string equal to the
converted stirng via the method getBytes().
|
java.lang.String |
toString()
Returns a string representation of the object.
|
byte |
typeId()
Returns the ASN.1 type identifier for the Octet String.
|
static final long serialVersionUID
private byte[] m_data
public static final byte ASNTYPE
public SnmpOctetString()
public SnmpOctetString(byte[] data)
data
- The data to be copied to selfpublic SnmpOctetString(SnmpOctetString second)
second
- The object to copy into selfprotected void assumeString(byte[] data)
data
- The new data buffer.public byte[] getString()
public void setString(byte[] data)
data
- The new octet string data.public void setString(java.lang.String data)
data
- The new octet string data.String.getBytes()
public int getLength()
public byte typeId()
typeId
in interface SnmpSyntax
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
encodeASN
in interface SnmpSyntax
buf
- The buffer to write the encoded information.offset
- The offset to start writing informationencoder
- The encoder object.AsnEncodingException
- Thrown if the encoder finds an error in the
buffer.public int decodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnDecodingException
decodeASN
in interface SnmpSyntax
buf
- The encode bufferoffset
- The offset byte to begin decodingencoder
- The decoder object.AsnDecodingException
- Thrown by the encoder if an error
occurs trying to decode the data buffer.public SnmpSyntax duplicate()
duplicate
in interface SnmpSyntax
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Generated by iurt on 2015.