SNMP Stack 5_1

uk.co.westhawk.snmp.stack
Class DefaultAsnOctetsPrintable

java.lang.Object
  |
  +--uk.co.westhawk.snmp.stack.DefaultAsnOctetsPrintable
All Implemented Interfaces:
AsnOctetsPrintableFace

public class DefaultAsnOctetsPrintable
extends java.lang.Object
implements AsnOctetsPrintableFace

Default implementation of AsnOctetsPrintableFace. This class has no effect on the way AsnOctets with type IPADDRESS or OPAQUE are printed.

When the type is ASN_OCTET_STR, the method tries to guess whether or not the string is printable; without the knowledge of the MIB it cannot distinguish between OctetString and any textual conventions, like DisplayString, InternationalDisplayString or DateAndTime.

Since:
4_14
Version:
$Revision: 3.3 $ $Date: 2006/01/17 17:43:54 $
Author:
Birgit Arkesteijn

Field Summary
 
Fields inherited from interface uk.co.westhawk.snmp.stack.AsnOctetsPrintableFace
version_id
 
Constructor Summary
DefaultAsnOctetsPrintable()
           
 
Method Summary
 boolean isPrintable(byte[] value)
          Returns whether or not the AsnOctets' byte array represent a printable string or not.
 java.lang.String toInternationalDisplayString(byte[] value)
          Returns the String according to the platform's default character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAsnOctetsPrintable

public DefaultAsnOctetsPrintable()
Method Detail

isPrintable

public boolean isPrintable(byte[] value)
Returns whether or not the AsnOctets' byte array represent a printable string or not.

This method can only make a rough guess. There is no way it always gets it right. It is much better to embed MIB knowledge in your implementation, and use toCalendar() or toDisplayString(), than calling toString().

Specified by:
isPrintable in interface AsnOctetsPrintableFace
See Also:
AsnOctets.toCalendar(), AsnOctets.toDisplayString(), AsnOctets.toHex(), AsnOctets.toString()

toInternationalDisplayString

public java.lang.String toInternationalDisplayString(byte[] value)
Returns the String according to the platform's default character set.

Specified by:
toInternationalDisplayString in interface AsnOctetsPrintableFace
See Also:
AsnOctetsPrintableFace.toInternationalDisplayString(byte[] value)

SNMP Stack 5_1