Package org.opennms.netmgt.snmp
Class AbstractSnmpValue
- java.lang.Object
-
- org.opennms.netmgt.snmp.AbstractSnmpValue
-
- All Implemented Interfaces:
SnmpValue
- Direct Known Subclasses:
MockSnmpValue
,Snmp4JValue
public abstract class AbstractSnmpValue extends Object implements SnmpValue
-
-
Field Summary
-
Fields inherited from interface org.opennms.netmgt.snmp.SnmpValue
SNMP_COUNTER32, SNMP_COUNTER64, SNMP_END_OF_MIB, SNMP_GAUGE32, SNMP_INT32, SNMP_IPADDRESS, SNMP_NO_SUCH_INSTANCE, SNMP_NO_SUCH_OBJECT, SNMP_NULL, SNMP_OBJECT_IDENTIFIER, SNMP_OCTET_STRING, SNMP_OPAQUE, SNMP_TIMETICKS
-
-
Constructor Summary
Constructors Constructor Description AbstractSnmpValue()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
allBytesDisplayable(byte[] bytes)
static boolean
allBytesISO_8859_1(byte[] bytes)
If the value is in the unprintable ASCII range (< 32) and is not a:static boolean
allBytesUTF_8(byte[] bytes)
Based on a modified version of http://stackoverflow.com/a/1447720 for UTF-8 detection.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.snmp.SnmpValue
getBytes, getType, isDisplayable, isEndOfMib, isError, isNull, isNumeric, toBigInteger, toDisplayString, toHexString, toInetAddress, toInt, toLong, toSnmpObjId
-
-
-
-
Method Detail
-
allBytesDisplayable
public static boolean allBytesDisplayable(byte[] bytes)
-
allBytesUTF_8
public static boolean allBytesUTF_8(byte[] bytes)
Based on a modified version of http://stackoverflow.com/a/1447720 for UTF-8 detection.
-
allBytesISO_8859_1
public static boolean allBytesISO_8859_1(byte[] bytes)
If the value is in the unprintable ASCII range (< 32) and is not a:
- Tab (9)
- Linefeed (10)
- Carriage return (13)
...or the byte is Delete (127) then this method will return false. Also, if the byte array has a NULL byte (0) that occurs anywhere besides the last character, return false. We will allow the NULL byte as a special case at the end of the string.
-
-