public class SnmpOctetString extends Object implements SnmpSyntax, Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
ASNTYPE
The ASN.1 value for the OCTET STRING type.
|
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.
|
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.
|
boolean |
equals(Object obj) |
int |
getLength()
Returns the internal length of the octet string.
|
byte[] |
getString()
Returns a reference to the internal object string.
|
int |
hashCode() |
void |
setString(byte[] data)
Sets the internal string array so that it is identical to the passed
array.
|
void |
setString(String data)
Sets the internal octet string equal to the converted stirng via the
method getBytes().
|
static String |
toDisplayString(SnmpOctetString octetString)
This method takes an SnmpOctetString and replaces any unprintable
characters with ASCII period ('.') and returns the resulting character
string.
|
static String |
toHexString(SnmpOctetString ostr) |
String |
toString()
Returns a string representation of the object.
|
byte |
typeId()
Returns the ASN.1 type identifier for the Octet String.
|
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(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 Object clone()
public String toString()
public static String toDisplayString(SnmpOctetString octetString)
octetString
- SnmpOctetString from which to generate the Stringpublic static String toHexString(SnmpOctetString ostr)
Copyright © 2021. All rights reserved.