org.snmp4j.PDU.toString()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.snmp4j.PDU.toString()方法的一些代码示例,展示了PDU.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.toString()方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:toString

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);
   }
  }
 }
}

相关文章