org.snmp4j.smi.OID.last()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(154)

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

OID.last介绍

[英]Returns the last sub-identifier as an integer value. If this OID is empty (i.e. has no sub-identifiers) then a NoSuchElementException is thrown
[中]以整数值形式返回最后一个子标识符。如果此OID为空(即没有子标识符),则会抛出NoTouchElementException

代码示例

代码示例来源:origin: org.snmp4j/snmp4j

/**
 * Returns the predecessor OID for this OID.
 *
 * @return if this OID ends on 0, then a {@link #MAX_OID_LEN}
 * sub-identifier OID is returned where each sub-ID for index greater
 * or equal to {@link #size()} is set to {@link #MAX_SUBID_VALUE}.
 * @since 1.7
 */
public final OID predecessor() {
  if (last() != 0) {
    int[] pval = new int[MAX_OID_LEN];
    System.arraycopy(value, 0, pval, 0, value.length);
    Arrays.fill(pval, value.length, pval.length, MAX_SUBID_VALUE);
    OID pred = new OID(pval);
    pred.set(size() - 1, last() - 1);
    return pred;
  } else {
    OID pred = new OID(this);
    pred.removeLast();
    return pred;
  }
}

代码示例来源:origin: org.snmp4j/snmp4j

vbs.add(vbLower);
OID lastOID = new OID(st.nextToken());
long last = lastOID.last();
long first = vbLower.getOid().lastUnsigned();
for (long k = first + 1; k <= last; k++) {

代码示例来源:origin: org.kaazing/snmp4j

/**
 * Returns the predecessor OID for this OID.
 * @return
 *    if this OID ends on 0, then a {@link #MAX_OID_LEN}
 *    sub-identifier OID is returned where each sub-ID for index greater
 *    or equal to {@link #size()} is set to {@link #MAX_SUBID_VALUE}.
 * @since 1.7
 */
public final OID predecessor() {
 if (last() != 0) {
  int[] pval = new int[MAX_OID_LEN];
  System.arraycopy(value, 0, pval, 0, value.length);
  Arrays.fill(pval, value.length, pval.length, MAX_SUBID_VALUE);
  OID pred = new OID(pval);
  pred.set(size()-1, last()-1);
  return pred;
 }
 else {
  OID pred = new OID(this);
  pred.removeLast();
  return pred;
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

/**
 * Returns the predecessor OID for this OID.
 * @return
 *    if this OID ends on 0, then a {@link #MAX_OID_LEN}
 *    sub-identifier OID is returned where each sub-ID for index greater
 *    or equal to {@link #size()} is set to {@link #MAX_SUBID_VALUE}.
 * @since 1.7
 */
public final OID predecessor() {
 if (last() != 0) {
  int[] pval = new int[MAX_OID_LEN];
  System.arraycopy(value, 0, pval, 0, value.length);
  Arrays.fill(pval, value.length, pval.length, MAX_SUBID_VALUE);
  OID pred = new OID(pval);
  pred.set(size()-1, last()-1);
  return pred;
 }
 else {
  OID pred = new OID(this);
  pred.removeLast();
  return pred;
 }
}

代码示例来源:origin: fbacchella/jrds

public Collection<int[]> getProcsOID() {
  boolean found = false;
  Collection<OID> soidSet = getIndexSet();
  Collection<int[]> oids = new HashSet<int[]>();
  TabularIterator ti = new TabularIterator(getConnection(), soidSet);
  for(SnmpVars s: ti) {
    List<OID> lk = new ArrayList<OID>(s.keySet());
    Collections.sort(lk);
    StringBuilder cmdBuf = new StringBuilder();
    for(OID oid: lk) {
      cmdBuf.append(s.get(oid));
      cmdBuf.append(' ');
    }
    if(pattern.matcher(cmdBuf.toString().trim()).matches()) {
      int[] index = new int[1];
      index[0] = lk.get(0).last();
      oids.add(index);
      found = true;
    }
  }
  if(!found) {
    log(Level.ERROR, "index for %s not found for host %s", indexKey, getHost().getName());
    oids = Collections.emptySet();
  } else {
    log(Level.DEBUG, "found %d processes", oids.size());
    log(Level.TRACE, "processes indexes found: %s", oids);
  }
  return oids;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

/**
 * Returns the next following OID with the same or lesser size (length).
 * @return OID
 *    the next OID on the same or upper level or a clone of this OID, if
 *    it has a zero length or is 2^32-1.
 * @since 1.7
 */
public final OID nextPeer() {
 OID next = new OID(this);
 if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) {
  next.set(next.size()-1, last()+1);
 }
 else if (next.size() > 1) {
  next.trim(1);
  next = next.nextPeer();
 }
 return next;
}

代码示例来源:origin: org.kaazing/snmp4j

/**
 * Returns the next following OID with the same or lesser size (length).
 * @return OID
 *    the next OID on the same or upper level or a clone of this OID, if
 *    it has a zero length or is 2^32-1.
 * @since 1.7
 */
public final OID nextPeer() {
 OID next = new OID(this);
 if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) {
  next.set(next.size()-1, last()+1);
 }
 else if (next.size() > 1) {
  next.trim(1);
  next = nextPeer();
 }
 return next;
}

代码示例来源:origin: org.snmp4j/snmp4j

/**
 * Returns the next following OID with the same or lesser size (length).
 *
 * @return OID
 * the next OID on the same or upper level or a clone of this OID, if
 * it has a zero length or is 2^32-1.
 * @since 1.7
 */
public final OID nextPeer() {
  OID next = new OID(this);
  if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) {
    next.set(next.size() - 1, last() + 1);
  } else if (next.size() > 1) {
    next.trim(1);
    next = next.nextPeer();
  }
  return next;
}

代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core

if(roid.last() != 0) {
  nextOid =  tableMapper.getNextTable(roid);
  if(nextOid != null) {

代码示例来源:origin: org.jboss.jbossas/jboss-snmp

if(roid.last() != 0) {
  nextOid =  tableMapper.getNextTable(roid);
  if(nextOid != null) {

代码示例来源:origin: org.jboss.jbossas/jboss-snmp

log.info("snmpReceivedSet: attempt to set a non-existent instance: " + oid.last() + " of object: " + oid.trim(), e);
undoSets(modified);
makeErrorPdu(response, pdu, errorIndex, PDU.noCreation);

代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core

log.info("snmpReceivedSet: attempt to set a non-existent instance: " + oid.last() + " of object: " + oid.trim(), e);
undoSets(modified);
makeErrorPdu(response, pdu, errorIndex, PDU.noCreation);

代码示例来源:origin: org.kaazing/snmp4j-agent

(nlmLogEntryModel.lastIndex().last() >= nextLogIndex)) {
nextLogIndex++;

代码示例来源:origin: org.snmp4j/snmp4j-agent

(nlmLogEntryModel.lastIndex().last() >= nextLogIndex)) {
nextLogIndex++;

代码示例来源:origin: org.snmp4j/snmp4j-agent

if (vb.getVariable() instanceof Counter64) {
  OID nextOID = new OID(vb.getOid());
  if (nextOID.last() < 65535) {
    nextOID.set(nextOID.size() - 1, 65535);
  } else {

代码示例来源:origin: org.kaazing/snmp4j-agent

if (vb.getVariable() instanceof Counter64) {
 OID nextOID = new OID(vb.getOid());
 if (nextOID.last() < 65535) {
  nextOID.set(nextOID.size()-1, 65535);

代码示例来源:origin: org.snmp4j/snmp4j-agent

trap.setEnterprise(enterprise);
trap.setSpecificTrap(notificationID.last());

代码示例来源:origin: org.kaazing/snmp4j-agent

trap.setEnterprise(enterprise);
trap.setSpecificTrap(notificationID.last());

相关文章