Methods Summary |
---|
public static java.lang.String | BinToChar(java.lang.String bin)Converts the specified binary string into a character string.
char value[] = new char[bin.length()/8];
int binLength = value.length;
for (int i = 0; i < binLength; i++)
value[i] = (char)Integer.parseInt(bin.substring(8*i, 8*i+8), 2);
return new String(value);
|
public static java.lang.String | HexToChar(java.lang.String hex)Converts the specified hexadecimal string into a character string.
char value[] = new char[hex.length()/2];
int hexLength = value.length;
for (int i = 0; i < hexLength; i++)
value[i] = (char)Integer.parseInt(hex.substring(2*i, 2*i+2), 16);
return new String(value);
|
public static void | appendToOid(SnmpOid source, SnmpOid dest)Appends an SnmpOid representing an SnmpString to another OID.
dest.append(source.getLength()) ;
dest.append(source) ;
|
public byte[] | byteValue()Returns the bytes array of this SnmpString .
return value ;
|
public synchronized java.lang.Object | clone()Clones the SnmpString object, making a copy of its data.
SnmpString newclone = null ;
try {
newclone = (SnmpString) super.clone() ;
newclone.value = new byte[value.length] ;
System.arraycopy(value, 0, newclone.value, 0, value.length) ;
} catch (CloneNotSupportedException e) {
throw new InternalError() ; // vm bug.
}
return newclone ;
|
public final synchronized SnmpValue | duplicate()Performs a clone action. This provides a workaround for the
SnmpValue interface.
return (SnmpValue) clone() ;
|
public java.lang.String | getTypeName()Returns a textual description of the type object.
return name ;
|
public java.net.InetAddress | inetAddressValue()Converts the string value to its InetAddress form.
return InetAddress.getByAddress(value);
|
public static int | nextOid(long[] index, int start)Scans an index OID, skips the string value and returns the position
of the next value.
try {
if (index[start] > Integer.MAX_VALUE) {
throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
}
int strLen = (int)index[start++] ;
start += strLen ;
if (start <= index.length) {
return start ;
}
else {
throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
}
}
catch(IndexOutOfBoundsException e) {
throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
}
|
public java.lang.Byte[] | toByte()Converts the string value to its array of Bytes form.
Byte[] result = new Byte[value.length] ;
for (int i = 0 ; i < value.length ; i++) {
result[i] = new Byte(value[i]) ;
}
return result ;
|
public SnmpOid | toOid()Converts the string value to its SnmpOid form.
long[] ids = new long[value.length] ;
for (int i = 0 ; i < value.length ; i++) {
ids[i] = (long)(value[i] & 0xFF) ;
}
return new SnmpOid(ids) ;
|
public static SnmpOid | toOid(long[] index, int start)Extracts the string from an index OID and returns its
value converted as an SnmpOid .
try {
if (index[start] > Integer.MAX_VALUE) {
throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
}
int strLen = (int)index[start++] ;
long[] ids = new long[strLen] ;
for (int i = 0 ; i < strLen ; i++) {
ids[i] = index[start + i] ;
}
return new SnmpOid(ids) ;
}
catch(IndexOutOfBoundsException e) {
throw new SnmpStatusException(SnmpStatusException.noSuchName) ;
}
|
public java.lang.String | toString()Converts the string value to its String form.
return new String(value) ;
|