- java.lang.Object
-
- org.snmp4j.util.SimpleOIDTextFormat
-
- All Implemented Interfaces:
OIDTextFormat
- Direct Known Subclasses:
DictionaryOIDTextFormat
public class SimpleOIDTextFormat extends java.lang.Object implements OIDTextFormat
TheSimpleOIDTextFormat
implements a simple textual representation for object IDs as dotted string.- Since:
- 1.10
- Version:
- 2.2
- Author:
- Frank Fock
-
-
Constructor Summary
Constructors Constructor Description SimpleOIDTextFormat()
Creates a simple OID text format.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(int[] value)
Returns a textual representation of a raw object ID as dotted string ("1.3.6.1.4").java.lang.String
formatForRoundTrip(int[] value)
Returns a textual representation of a raw object ID as dotted string ("1.3.6.1.4").static java.lang.String
formatOID(int[] value)
Returns a textual representation of a raw object ID as dotted string ("1.3.6.1.4").int[]
parse(java.lang.String text)
Parses a textual representation of an object ID as dotted string (e.g.static int[]
parseOID(java.lang.String text)
Parses a textual representation of an object ID as dotted string (e.g.
-
-
-
Method Detail
-
formatOID
public static java.lang.String formatOID(int[] value)
Returns a textual representation of a raw object ID as dotted string ("1.3.6.1.4").- Parameters:
value
- the OID value to format.- Returns:
- the textual representation.
-
format
public java.lang.String format(int[] value)
Returns a textual representation of a raw object ID as dotted string ("1.3.6.1.4").- Specified by:
format
in interfaceOIDTextFormat
- Parameters:
value
- the OID value to format.- Returns:
- the textual representation.
-
formatForRoundTrip
public java.lang.String formatForRoundTrip(int[] value)
Returns a textual representation of a raw object ID as dotted string ("1.3.6.1.4"). This method is the same asformat(int[])
.- Specified by:
formatForRoundTrip
in interfaceOIDTextFormat
- Parameters:
value
- the OID value to format.- Returns:
- the textual representation.
-
parseOID
public static int[] parseOID(java.lang.String text) throws java.text.ParseException
Parses a textual representation of an object ID as dotted string (e.g. "1.3.6.1.2.1.1") and returns its raw value.- Parameters:
text
- a textual representation of an OID.- Returns:
- the raw OID value.
- Throws:
java.text.ParseException
- if the OID cannot be parsed successfully.
-
parse
public int[] parse(java.lang.String text) throws java.text.ParseException
Parses a textual representation of an object ID as dotted string (e.g. "1.3.6.1.2.1.1") and returns its raw value.- Specified by:
parse
in interfaceOIDTextFormat
- Parameters:
text
- a textual representation of an OID.- Returns:
- the raw OID value.
- Throws:
java.text.ParseException
- if the OID cannot be parsed successfully.
-
-