• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SMIConstants类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.snmp4j.smi.SMIConstants的典型用法代码示例。如果您正苦于以下问题:Java SMIConstants类的具体用法?Java SMIConstants怎么用?Java SMIConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SMIConstants类属于org.snmp4j.smi包,在下文中一共展示了SMIConstants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processResponse

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
/**
 * TODO: Merge this logic with {@link Snmp4JWalker.Snmp4JResponseListener#processResponse(PDU response)}
 */
private static SnmpValue[] processResponse(Snmp4JAgentConfig agentConfig, ResponseEvent responseEvent) throws IOException {
    SnmpValue[] retvalues = { null };

    if (responseEvent.getResponse() == null) {
        log().warn("processResponse: Timeout.  Agent: "+agentConfig);
    } else if (responseEvent.getError() != null) {
        log().warn("processResponse: Error during get operation.  Error: "+responseEvent.getError().getLocalizedMessage(), responseEvent.getError());
    } else if (responseEvent.getResponse().getType() == PDU.REPORT) {
        log().warn("processResponse: Error during get operation.  Report returned with varbinds: "+responseEvent.getResponse().getVariableBindings());
    } else if (responseEvent.getResponse().getVariableBindings().size() < 1) {
        log().warn("processResponse: Received PDU with 0 varbinds.");
    } else if (responseEvent.getResponse().get(0).getSyntax() == SMIConstants.SYNTAX_NULL) {
        log().info("processResponse: Null value returned in varbind: " + responseEvent.getResponse().get(0));
    } else {
        retvalues = convertResponseToValues(responseEvent);

        if (log().isDebugEnabled()) {
            log().debug("processResponse: SNMP operation successful, value: "+Arrays.toString(retvalues));
        }
    }

    return retvalues;
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:27,代码来源:Snmp4JStrategy.java


示例2: testGetNextMultipleVarbinds

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testGetNextMultipleVarbinds() throws Exception {

    request("1.3.5.1.1.3").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGetNext();

    m_agent.getUsm().setEngineBoots(15);

    request("1.3.5.1.1.3").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGetNext();

    request("1.3.5.1.1.3").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGetNext();

    // This statement breaks the internal state of the SNMP4J agent
    // m_agent.getUsm().setLocalEngine(m_agent.getUsm().getLocalEngineID(), 15, 200);
    m_agent.getUsm().removeEngineTime(m_usm.getLocalEngineID());
    m_usm.removeEngineTime(m_agent.getUsm().getLocalEngineID());

    request("1.3.5.1.1.3").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGetNext();

}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:24,代码来源:MockSnmpAgentTest.java


示例3: testSineWaveResponder

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testSineWaveResponder() throws Exception {
    String oid = "1.3.5.1.1.10.0";
    request(oid).andExpect(oid, SMIConstants.SYNTAX_INTEGER, new Integer32(0));
    doGet();

    oid = "1.3.5.1.1.10.30";
    request(oid).andExpect(oid, SMIConstants.SYNTAX_INTEGER, new Integer32(50));
    doGet();

    oid = "1.3.5.1.1.10.45";
    request(oid).andExpect(oid, SMIConstants.SYNTAX_INTEGER, new Integer32(71));
    doGet();

    oid = "1.3.5.1.1.10.90";
    request(oid).andExpect(oid, SMIConstants.SYNTAX_INTEGER, new Integer32(100));
    doGet();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:19,代码来源:MockSnmpAgentTest.java


示例4: testPreparePduWithNoValues

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testPreparePduWithNoValues() throws Exception {
    SnmpObjId[] oids = new SnmpObjId[] {
            SnmpObjId.get(".1.3.5.1.1.3.0"),
            SnmpObjId.get(".1.3.5.1.1.4.0"),
    };
    
    SnmpValue[] values = null;
    
    PDU pdu = m_strategy.buildPdu(new Snmp4JAgentConfig(getAgentConfig()), PDU.SET, oids, values);
    assertNotNull("PDU should not be null", pdu);
    
    assertEquals("PDU variable bindings size", oids.length, pdu.getVariableBindings().size());
    
    for (int i = 0; i < oids.length; i++) {
        VariableBinding vb = pdu.get(i);
        assertEquals("PDU variable binding " + i + " OID", oids[i].toString(), "." + vb.getOid().toString());
        assertEquals("PDU variable binding " + i + " syntax", vb.getSyntax(), SMIConstants.SYNTAX_NULL);
        assertEquals("PDU variable binding " + i + " variable syntax", vb.getVariable().getSyntax(), SMIConstants.SYNTAX_NULL);
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:22,代码来源:Snmp4JStrategyTest.java


示例5: testPreparePduWithValues

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testPreparePduWithValues() throws Exception {
    SnmpObjId[] oids = new SnmpObjId[] {
            SnmpObjId.get(".1.3.5.1.1.3.0"),
            SnmpObjId.get(".1.3.5.1.1.4.0"),
    };
    
    SnmpValue[] values = new SnmpValue[] {
            snmpValue("foo"),
            snmpValue("bar")
    };
    
    PDU pdu = m_strategy.buildPdu(new Snmp4JAgentConfig(getAgentConfig()), PDU.SET, oids, values);
    assertNotNull("PDU should not be null", pdu);
    
    assertEquals("PDU variable bindings size", oids.length, pdu.getVariableBindings().size());
    
    for (int i = 0; i < oids.length; i++) {
        VariableBinding vb = pdu.get(i);
        assertEquals("PDU variable binding " + i + " OID", oids[i].toString(), "." + vb.getOid().toString());
        assertEquals("PDU variable binding " + i + " syntax", vb.getSyntax(), SMIConstants.SYNTAX_OCTET_STRING);
        assertEquals("PDU variable binding " + i + " variable syntax", vb.getVariable().getSyntax(), SMIConstants.SYNTAX_OCTET_STRING);
        assertEquals("PDU variable binding " + i + " variable value", vb.getVariable().toString(), values[i].toString());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:26,代码来源:Snmp4JStrategyTest.java


示例6: getTimeStamp

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
protected long getTimeStamp() {

        	if (log().isDebugEnabled()) {
                log().debug("V2 "+m_pduTypeString+" first varbind value: " + getVarBindAt(0).getVariable().toString());
            }

            switch (getVarBindAt(SNMP_SYSUPTIME_OID_INDEX).getVariable().getSyntax()) {
            case SMIConstants.SYNTAX_TIMETICKS:
                log().debug("V2 "+m_pduTypeString+" first varbind value is of type TIMETICKS (correct)");
                return ((TimeTicks) getVarBindAt(SNMP_SYSUPTIME_OID_INDEX).getVariable()).getValue();
            case SMIConstants.SYNTAX_INTEGER32:
                log().debug("V2 "+m_pduTypeString+" first varbind value is of type INTEGER, casting to TIMETICKS");
                return ((Integer32) getVarBindAt(SNMP_SYSUPTIME_OID_INDEX).getVariable()).getValue();
            default:
                throw new IllegalArgumentException("V2 "+m_pduTypeString+" does not have the required first varbind as TIMETICKS - cannot process "+m_pduTypeString);
            }
        }
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:Snmp4JTrapNotifier.java


示例7: getBytes

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public byte[] getBytes() {
    switch (m_value.getSyntax()) {
    case SMIConstants.SYNTAX_INTEGER:
    case SMIConstants.SYNTAX_COUNTER32:
    case SMIConstants.SYNTAX_COUNTER64:
    case SMIConstants.SYNTAX_TIMETICKS:
    case SMIConstants.SYNTAX_UNSIGNED_INTEGER32:
        return toBigInteger().toByteArray();
    case SMIConstants.SYNTAX_IPADDRESS:
        return toInetAddress().getAddress();
    case SMIConstants.SYNTAX_OBJECT_IDENTIFIER:
        return toSnmpObjId().toString().getBytes();
    case SMIConstants.SYNTAX_OCTET_STRING:
        return ((OctetString)m_value).getValue();
    case SMIConstants.SYNTAX_OPAQUE:
        return((Opaque)m_value).getValue();
    case SMIConstants.EXCEPTION_END_OF_MIB_VIEW:
    case SMIConstants.EXCEPTION_NO_SUCH_INSTANCE:
    case SMIConstants.EXCEPTION_NO_SUCH_OBJECT:
    case SMIConstants.SYNTAX_NULL:
        return new byte[0];
    default:
        throw new IllegalArgumentException("cannot convert "+m_value+" to a byte array");
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:26,代码来源:Snmp4JValue.java


示例8: toLong

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public long toLong() {
    switch (m_value.getSyntax()) {
    case SMIConstants.SYNTAX_COUNTER64:
        return ((Counter64)m_value).getValue();
    case SMIConstants.SYNTAX_INTEGER:
        return ((Integer32)m_value).getValue();
    case SMIConstants.SYNTAX_COUNTER32:
    case SMIConstants.SYNTAX_TIMETICKS:
    case SMIConstants.SYNTAX_UNSIGNED_INTEGER32:
        return ((UnsignedInteger32)m_value).getValue();
    case SMIConstants.SYNTAX_OCTET_STRING:
        return (convertStringToLong());
    default:
        return Long.parseLong(m_value.toString());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:17,代码来源:Snmp4JValue.java


示例9: toBigInteger

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public BigInteger toBigInteger() {
    switch (m_value.getSyntax()) {
    case SMIConstants.SYNTAX_COUNTER64:
        final Counter64 cnt = (Counter64)m_value;
        if (cnt.getValue() > 0) {
            return BigInteger.valueOf(cnt.getValue());
        } else {
            return new BigInteger(cnt.toString());
        }
    case SMIConstants.SYNTAX_INTEGER:
        return BigInteger.valueOf(((Integer32)m_value).getValue());
    case SMIConstants.SYNTAX_COUNTER32:
    case SMIConstants.SYNTAX_TIMETICKS:
    case SMIConstants.SYNTAX_UNSIGNED_INTEGER32:
        return BigInteger.valueOf(((UnsignedInteger32)m_value).getValue());
    default:
        return new BigInteger(m_value.toString());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:20,代码来源:Snmp4JValue.java


示例10: testUpdateFromFileWithUSMTimeReset

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public void testUpdateFromFileWithUSMTimeReset() throws Exception {
    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));

    m_agent.getUsm().setEngineBoots(15);

    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));

    // This statement breaks the internal state of the SNMP4J agent
    // m_agent.getUsm().setLocalEngine(m_agent.getUsm().getLocalEngineID(), 15, 200);
    m_agent.getUsm().removeEngineTime(m_usm.getLocalEngineID());
    m_usm.removeEngineTime(m_agent.getUsm().getLocalEngineID());

    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));

    m_usm.removeEngineTime(m_agent.getUsm().getLocalEngineID());

    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    assertResultFromGet("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:22,代码来源:MockSnmpAgentTest.java


示例11: testPreparePduWithNoValues

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public void testPreparePduWithNoValues() throws Exception {
    SnmpObjId[] oids = new SnmpObjId[] {
            SnmpObjId.get(".1.3.5.1.1.3.0"),
            SnmpObjId.get(".1.3.5.1.1.4.0"),
    };
    
    SnmpValue[] values = null;
    
    PDU pdu = m_strategy.buildPdu(new Snmp4JAgentConfig(getAgentConfig()), PDU.SET, oids, values);
    assertNotNull("PDU should not be null", pdu);
    
    assertEquals("PDU variable bindings size", oids.length, pdu.getVariableBindings().size());
    
    for (int i = 0; i < oids.length; i++) {
        VariableBinding vb = pdu.get(i);
        assertEquals("PDU variable binding " + i + " OID", oids[i].toString(), "." + vb.getOid().toString());
        assertEquals("PDU variable binding " + i + " syntax", vb.getSyntax(), SMIConstants.SYNTAX_NULL);
        assertEquals("PDU variable binding " + i + " variable syntax", vb.getVariable().getSyntax(), SMIConstants.SYNTAX_NULL);
    }
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:21,代码来源:Snmp4JStrategyTest.java


示例12: testPreparePduWithValues

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public void testPreparePduWithValues() throws Exception {
    SnmpObjId[] oids = new SnmpObjId[] {
            SnmpObjId.get(".1.3.5.1.1.3.0"),
            SnmpObjId.get(".1.3.5.1.1.4.0"),
    };
    
    SnmpValue[] values = new SnmpValue[] {
            new StringSnmpValue("foo"),
            new StringSnmpValue("bar")
    };
    
    PDU pdu = m_strategy.buildPdu(new Snmp4JAgentConfig(getAgentConfig()), PDU.SET, oids, values);
    assertNotNull("PDU should not be null", pdu);
    
    assertEquals("PDU variable bindings size", oids.length, pdu.getVariableBindings().size());
    
    for (int i = 0; i < oids.length; i++) {
        VariableBinding vb = pdu.get(i);
        assertEquals("PDU variable binding " + i + " OID", oids[i].toString(), "." + vb.getOid().toString());
        assertEquals("PDU variable binding " + i + " syntax", vb.getSyntax(), SMIConstants.SYNTAX_OCTET_STRING);
        assertEquals("PDU variable binding " + i + " variable syntax", vb.getVariable().getSyntax(), SMIConstants.SYNTAX_OCTET_STRING);
        assertEquals("PDU variable binding " + i + " variable value", vb.getVariable().toString(), values[i].toString());
    }
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:25,代码来源:Snmp4JStrategyTest.java


示例13: getBytes

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public byte[] getBytes() {
    switch (m_value.getSyntax()) {
    case SMIConstants.SYNTAX_INTEGER:
    case SMIConstants.SYNTAX_COUNTER32:
    case SMIConstants.SYNTAX_COUNTER64:
    case SMIConstants.SYNTAX_TIMETICKS:
    case SMIConstants.SYNTAX_UNSIGNED_INTEGER32:
        return toBigInteger().toByteArray();
    case SMIConstants.SYNTAX_IPADDRESS:
        return toInetAddress().getAddress();
    case SMIConstants.SYNTAX_OBJECT_IDENTIFIER:
        return toSnmpObjId().toString().getBytes();
    case SMIConstants.SYNTAX_OCTET_STRING:
        return ((OctetString)m_value).getValue();
    case SMIConstants.SYNTAX_OPAQUE:
        return((Opaque)m_value).getValue();
    case SMIConstants.SYNTAX_NULL:
        return new byte[0];
    default:
        throw new IllegalArgumentException("cannot convert "+m_value+" to a byte array");
    }
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:23,代码来源:Snmp4JValue.java


示例14: newNotification

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
private Snmp4jNotification newNotification(CommandResponderEvent event,
    SnmpTarget target, VarbindCollection varbinds) {
  switch (event.getPDU().getType()) {
    case PDU.V1TRAP:
      Snmp4jV1Trap trap = new Snmp4jV1Trap(target, varbinds);
      PDUv1 pdu = (PDUv1) event.getPDU();
      trap.setEnterprise(pdu.getEnterprise().toString());
      trap.setAgentAddress(pdu.getAgentAddress().toString());
      MibTrapV1Support trapSupport = varbindFactory.getMib()
          .getV1TrapSupport();
      trap.setGenericType(new ImmutableObjectValue(SMIConstants.SYNTAX_INTEGER,
          pdu.getGenericTrap(), trapSupport.getGenericTrapFormatter()));
      trap.setSpecificType(new ImmutableObjectValue(SMIConstants.SYNTAX_INTEGER,
          pdu.getSpecificTrap(), trapSupport.getSpecificTrapFormatter()));
      trap.setTimestamp(new ImmutableObjectValue(SMIConstants.SYNTAX_TIMETICKS,
          pdu.getTimestamp(), trapSupport.getTimestampFormatter()));
      return trap;
    case PDU.INFORM:
      return new Snmp4jNotification(SnmpNotification.Type.INFORM, target,
          varbinds);
    case PDU.TRAP:
      return new Snmp4jNotification(SnmpNotification.Type.TRAP, target,
          varbinds);
    default:
      throw new IllegalArgumentException("unrecognized PDU type");
  }
}
 
开发者ID:soulwing,项目名称:tnm4j,代码行数:28,代码来源:Snmp4jNotificationEventFactory.java


示例15: standardFilterCriteria

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public boolean standardFilterCriteria(SmiModule module,SmiObject object) {
	boolean output = false;
	
	if (object.getType() == SmiType.OBJECT_TYPE_SCALAR &&
		(object.getSmiSyntax() == SMIConstants.SYNTAX_COUNTER32 ||
		 object.getSmiSyntax() == SMIConstants.SYNTAX_COUNTER64 ||
		 object.getSmiSyntax() == SMIConstants.SYNTAX_GAUGE32 ||
		 object.getSmiSyntax() == SMIConstants.SYNTAX_INTEGER32)) {
		output = true;
	}
	return output;
}
 
开发者ID:boundary,项目名称:boundary-event-sdk,代码行数:13,代码来源:MibTransformBase.java


示例16: testUpdateFromFileWithUSMTimeReset

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testUpdateFromFileWithUSMTimeReset() throws Exception {
    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();

    m_agent.getUsm().setEngineBoots(15);

    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();
    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();

    // This statement breaks the internal state of the SNMP4J agent
    // m_agent.getUsm().setLocalEngine(m_agent.getUsm().getLocalEngineID(), 15, 200);
    m_agent.getUsm().removeEngineTime(m_usm.getLocalEngineID());
    m_usm.removeEngineTime(m_agent.getUsm().getLocalEngineID());

    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();
    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();

    m_usm.removeEngineTime(m_agent.getUsm().getLocalEngineID());

    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();
    request("1.3.5.1.1.3.0").andExpect("1.3.5.1.1.3.0", SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:30,代码来源:MockSnmpAgentTest.java


示例17: testSleeperResponder

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testSleeperResponder() throws Exception {
    final String myOid = "1.3.5.1.1.11.0";

    // Verify that the sleeper responds correctly
    Sleeper.getInstance().setVariable(new Integer32(1));
    request(myOid).andExpect(myOid, SMIConstants.SYNTAX_INTEGER, new Integer32(1));
    doGet();

    // Set the timeout
    Sleeper.getInstance().setSleepTime(DEFAULT_TIMEOUT + 1000);

    // Make another request
    PDU pdu = createPDU(m_version);
    OID oid = new OID(myOid);
    pdu.add(new VariableBinding(oid));
    pdu.setType(PDU.GET);

    PDU response = sendRequest(pdu,m_version);
    // Verify that the request does in fact timeout
    assertNull("request timed out", response);

    // Clear the timeout
    Sleeper.getInstance().setSleepTime(0);

    // Update the variable
    Sleeper.getInstance().setVariable(new OctetString("Bingo!"));
    request(myOid).andExpect(myOid, SMIConstants.SYNTAX_OCTET_STRING, new OctetString("Bingo!"));
    doGet();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:31,代码来源:MockSnmpAgentTest.java


示例18: testDynamicVariableCacheAfterUpdateFromFile

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
@Test
public void testDynamicVariableCacheAfterUpdateFromFile() throws Exception {
    final String oid = "1.3.5.1.1.10.0";
    request(oid).andExpect(oid, SMIConstants.SYNTAX_INTEGER, new Integer32(0));
    doGet();

    m_agent.updateValuesFromResource(classPathResource("differentSnmpData.properties"));

    Sleeper.getInstance().resetWithVariable(new Integer32(42));
    request(oid).andExpect(oid, SMIConstants.SYNTAX_INTEGER, new Integer32(42));
    doGet();
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:13,代码来源:MockSnmpAgentTest.java


示例19: isNumeric

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public boolean isNumeric() {
    switch (m_value.getSyntax()) {
    case SMIConstants.SYNTAX_INTEGER:
    case SMIConstants.SYNTAX_COUNTER32:
    case SMIConstants.SYNTAX_COUNTER64:
    case SMIConstants.SYNTAX_TIMETICKS:
    case SMIConstants.SYNTAX_UNSIGNED_INTEGER32:
        return true;
    default:
        return false;
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:13,代码来源:Snmp4JValue.java


示例20: toInt

import org.snmp4j.smi.SMIConstants; //导入依赖的package包/类
public int toInt() {
    switch (m_value.getSyntax()) {
    case SMIConstants.SYNTAX_COUNTER64:
        return (int)((Counter64)m_value).getValue();
    case SMIConstants.SYNTAX_INTEGER:
        return ((Integer32)m_value).getValue();
    case SMIConstants.SYNTAX_COUNTER32:
    case SMIConstants.SYNTAX_TIMETICKS:
    case SMIConstants.SYNTAX_UNSIGNED_INTEGER32:
        return (int)((UnsignedInteger32)m_value).getValue();
    default:
        return Integer.parseInt(m_value.toString());
    }
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:15,代码来源:Snmp4JValue.java



注:本文中的org.snmp4j.smi.SMIConstants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Accessor类代码示例发布时间:2022-05-23
下一篇:
Java RedstoneWire类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap