com.sun.jaw.snmp.common
Class SnmpPduFactory
java.lang.Object
|
+--com.sun.jaw.snmp.common.SnmpPduFactory
- public class SnmpPduFactory
- extends java.lang.Object
- implements SnmpPduFactoryIf
The SnmpPduFactory
is the default implementation
of the SnmpPduFactoryIf interface.
You normally don't need to use this class except if you
decide to implement your own SnmpPduFactoryIf
object.
This implementation of SnmpPduFactoryIf
is very
basic: it simply calls encoding and decoding methods from
SnmpMessage.
public SnmpPduPacket decodePdu(SnmpMessage msg)
throws SnmpStatusException {
return msg.decodePdu() ;
}
public SnmpMessage encodePdu(SnmpPduPacket pdu, int maxPktSize)
throws SnmpStatusException, SnmpTooBigException {
SnmpMessage result = new SnmpMessage() ;
result.encodePdu(pdu, maxPktSize) ;
return result ;
}
To implement your own object, you can implement SnmpPduFactoryIf
or extend SnmpPduFactory
.
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SnmpPduFactory
public SnmpPduFactory()
decodePdu
public SnmpPduPacket decodePdu(SnmpMessage msg)
throws SnmpStatusException
- Calls SnmpMessage.decodePdu
on the specified message and returns the resulting
SnmpPduPacket
.
- Specified by:
- decodePdu in interface SnmpPduFactoryIf
- Parameters:
msg
- The SnmpMessage to be decoded.- Returns:
- The resulting SnmpPduPacket.
- Throws:
- SnmpStatusException - If the encoding is invalid.
encodePdu
public SnmpMessage encodePdu(SnmpPduPacket pdu,
int maxPktSize)
throws SnmpStatusException,
SnmpTooBigException
- Calls SnmpMessage.encodePdu
on the specified
SnmpPduPacket
and returns the resulting SnmpMessage
.
- Specified by:
- encodePdu in interface SnmpPduFactoryIf
- Parameters:
pdu
- The SnmpPduPacket
to be encoded.maxPktSize
- The size limit of the resulting encoding.- Returns:
- The encoded message.
- Throws:
- SnmpStatusException - If
pdu
contains illegal
values and cannot be encoded.- SnmpTooBigException - If the resulting encoding does not fit
in
maxPktSize
bytes.