org.snmp4j.util
Class SimpleVariableTextFormat

java.lang.Object
  extended by org.snmp4j.util.SimpleVariableTextFormat
All Implemented Interfaces:
VariableTextFormat

public class SimpleVariableTextFormat
extends java.lang.Object
implements VariableTextFormat

The SimpleVariableTextFormat implements a simple textual representation for SNMP variables based on their type only. No MIB information is used (can be used).

Since:
1.10
Version:
1.10
Author:
Frank Fock

Constructor Summary
SimpleVariableTextFormat()
          Creates a simple variable text format.
 
Method Summary
 java.lang.String format(OID instanceOID, Variable variable, boolean withOID)
          Returns a textual representation of the supplied variable against the optionally supplied instance OID.
 Variable parse(int smiSyntax, java.lang.String text)
          This operation is not supported by SimpleVariableTextFormat.
 Variable parse(OID classOrInstanceOID, java.lang.String text)
          This operation is not supported by SimpleVariableTextFormat.
 VariableBinding parseVariableBinding(java.lang.String text)
          Parses a textual representation of a variable binding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleVariableTextFormat

public SimpleVariableTextFormat()
Creates a simple variable text format.

Method Detail

format

public java.lang.String format(OID instanceOID,
                               Variable variable,
                               boolean withOID)
Returns a textual representation of the supplied variable against the optionally supplied instance OID.

Specified by:
format in interface VariableTextFormat
Parameters:
instanceOID - the instance OID variable is associated with. If null the formatting cannot take any MIB specification of the variable into account and has to format it based on its type only.
variable - the variable to format.
withOID - if true the instanceOID should be included in the textual representation to form a VariableBinding representation.
Returns:
the textual representation.

parse

public Variable parse(int smiSyntax,
                      java.lang.String text)
               throws java.text.ParseException
This operation is not supported by SimpleVariableTextFormat.

Specified by:
parse in interface VariableTextFormat
Parameters:
smiSyntax - the SMI syntax identifier identifying the target Variable.
text - a textual representation of the variable.
Returns:
the new Variable instance.
Throws:
java.text.ParseException - if the variable cannot be parsed successfully.

parse

public Variable parse(OID classOrInstanceOID,
                      java.lang.String text)
               throws java.text.ParseException
This operation is not supported by SimpleVariableTextFormat.

Specified by:
parse in interface VariableTextFormat
Parameters:
classOrInstanceOID - the instance OID variable is associated with. Must not be null.
text - a textual representation of the variable.
Returns:
the new Variable instance.
Throws:
java.text.ParseException - if the variable cannot be parsed successfully.

parseVariableBinding

public VariableBinding parseVariableBinding(java.lang.String text)
                                     throws java.text.ParseException
Description copied from interface: VariableTextFormat
Parses a textual representation of a variable binding.

Specified by:
parseVariableBinding in interface VariableTextFormat
Parameters:
text - a textual representation of the variable binding.
Returns:
the new VariableBinding instance.
Throws:
java.text.ParseException - if the variable binding cannot be parsed successfully.

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.