本文整理了Java中org.snmp4j.PDU.toString()
方法的一些代码示例,展示了PDU.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.toString()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:toString
[英]Returns a string representation of the object.
[中]返回对象的字符串表示形式。
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
public String toString() {
if (type == PDU.V1TRAP) {
StringBuilder buf = new StringBuilder();
buf.append(getTypeString(type));
buf.append("[reqestID=");
buf.append(requestID);
buf.append(",timestamp=");
buf.append(timestamp);
buf.append(",enterprise=");
buf.append(enterprise);
buf.append(",genericTrap=");
buf.append(genericTrap);
buf.append(",specificTrap=");
buf.append(specificTrap);
buf.append(", VBS[");
for (int i = 0; i < variableBindings.size(); i++) {
buf.append(variableBindings.get(i));
if (i + 1 < variableBindings.size()) {
buf.append("; ");
}
}
buf.append("]]");
return buf.toString();
}
return super.toString();
}
代码示例来源:origin: org.snmp4j/snmp4j
public String toString() {
if (type == PDU.V1TRAP) {
StringBuilder buf = new StringBuilder();
buf.append(getTypeString(type));
buf.append("[reqestID=");
buf.append(requestID);
buf.append(",timestamp=");
buf.append(timestamp);
buf.append(",enterprise=");
buf.append(enterprise);
buf.append(",genericTrap=");
buf.append(genericTrap);
buf.append(",specificTrap=");
buf.append(specificTrap);
buf.append(", VBS[");
for (int i = 0; i < variableBindings.size(); i++) {
buf.append(variableBindings.get(i));
if (i + 1 < variableBindings.size()) {
buf.append("; ");
}
}
buf.append("]]");
return buf.toString();
}
return super.toString();
}
代码示例来源:origin: org.kaazing/snmp4j
public String toString() {
if (type == PDU.V1TRAP) {
StringBuffer buf = new StringBuffer();
buf.append(getTypeString(type));
buf.append("[reqestID=");
buf.append(requestID);
buf.append(",timestamp=");
buf.append(timestamp);
buf.append(",enterprise=");
buf.append(enterprise);
buf.append(",genericTrap=");
buf.append(genericTrap);
buf.append(",specificTrap=");
buf.append(specificTrap);
buf.append(", VBS[");
for (int i = 0; i < variableBindings.size(); i++) {
buf.append(variableBindings.get(i));
if (i + 1 < variableBindings.size()) {
buf.append("; ");
}
}
buf.append("]]");
return buf.toString();
}
return super.toString();
}
代码示例来源:origin: Stratio/ingestion
public synchronized void processPdu(CommandResponderEvent e) {
PDU command = e.getPDU();
if (command != null) {
ChannelProcessor channelProcessor = getChannelProcessor();
sourceCounter.addToEventReceivedCount(1);
sourceCounter.incrementAppendBatchReceivedCount();
channelProcessor.processEvent(EventBuilder.withBody(command.toString(),
Charsets.UTF_8));
sourceCounter.addToEventAcceptedCount(1);
sourceCounter.incrementAppendBatchAcceptedCount();
}
}
};
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
System.out.println(respPDU.toString());
代码示例来源:origin: org.snmp4j/snmp4j
System.out.println(respPDU.toString());
代码示例来源:origin: org.kaazing/snmp4j
System.out.println(respPDU.toString());
代码示例来源:origin: org.kaazing/snmp4j
public synchronized void processPdu(CommandResponderEvent e) {
PDU command = e.getPDU();
if (command != null) {
System.out.println(command.toString());
if ((command.getType() != PDU.TRAP) &&
(command.getType() != PDU.V1TRAP) &&
代码示例来源:origin: org.snmp4j/snmp4j
public synchronized void processPdu(CommandResponderEvent e) {
PDU command = e.getPDU();
if (command != null) {
if ((command.getType() != PDU.TRAP) &&
(command.getType() != PDU.V1TRAP) &&
(command.getType() != PDU.REPORT) &&
(command.getType() != PDU.RESPONSE)) {
out.println(command.toString());
command.setErrorIndex(0);
command.setErrorStatus(0);
command.setType(PDU.RESPONSE);
StatusInformation statusInformation = new StatusInformation();
StateReference ref = e.getStateReference();
try {
e.getMessageDispatcher().returnResponsePdu(e.
getMessageProcessingModel(),
e.getSecurityModel(),
e.getSecurityName(),
e.getSecurityLevel(),
command,
e.getMaxSizeResponsePDU(),
ref,
statusInformation);
} catch (MessageException ex) {
err.println("Error while sending response: " + ex.getMessage());
LogFactory.getLogger(SnmpCommand.class).error(ex);
}
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
public synchronized void processPdu(CommandResponderEvent e) {
PDU command = e.getPDU();
if (command != null) {
System.out.println(command.toString());
if ((command.getType() != PDU.TRAP) &&
(command.getType() != PDU.V1TRAP) &&
(command.getType() != PDU.REPORT) &&
(command.getType() != PDU.RESPONSE)) {
command.setErrorIndex(0);
command.setErrorStatus(0);
command.setType(PDU.RESPONSE);
StatusInformation statusInformation = new StatusInformation();
StateReference ref = e.getStateReference();
try {
e.getMessageDispatcher().returnResponsePdu(e.getMessageProcessingModel(),
e.getSecurityModel(),
e.getSecurityName(),
e.getSecurityLevel(),
command,
e.getMaxSizeResponsePDU(),
ref,
statusInformation);
}
catch (MessageException ex) {
System.err.println("Error while sending response: "+ex.getMessage());
LogFactory.getLogger(SnmpRequest.class).error(ex);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!