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

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

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

OID.set介绍

[英]Sets the sub-identifier at the specified position.
[中]在指定位置设置子标识符。

代码示例

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

public OID toSubIndex(boolean impliedLength) {
 byte[] address = new byte[4];
 System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4);
 OID subIndex = new OID(new int[4]);
 for (int i=0; i<address.length; i++) {
  subIndex.set(i, address[i] & 0xFF);
 }
 return subIndex;
}

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

public OID toSubIndex(boolean impliedLength) {
 byte[] address = new byte[4];
 System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4);
 OID subIndex = new OID(new int[4]);
 for (int i=0; i<address.length; i++) {
  subIndex.set(i, address[i] & 0xFF);
 }
 return subIndex;
}

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

public OID toSubIndex(boolean impliedLength) {
 byte[] address = new byte[4];
 System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4);
 OID subIndex = new OID(new int[4]);
 for (int i=0; i<address.length; i++) {
  subIndex.set(i, address[i] & 0xFF);
 }
 return subIndex;
}

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

public OID getUpperBound() {
  OID upperBound = new OID(oid);
  int lastID = oid.size() - 1;
  /**
   * This is not quite correct because we would have to search up the tree
   * if the last sub ID is 0xFFFFFFFF, but since a table OID must end on 1
   * by SMI rules we should be on the safe side here.
   */
  upperBound.set(lastID, oid.get(lastID) + 1);
  return upperBound;
}

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

public OID getUpperBound() {
 OID upperBound = new OID(oid);
 int lastID = oid.size()-1;
 /**
  * This is not quite correct because we would have to search up the tree
  * if the last sub ID is 0xFFFFFFFF, but since a table OID must end on 1
  * by SMI rules we should be on the safe side here.
  */
 upperBound.set(lastID, oid.get(lastID)+1);
 return upperBound;
}

代码示例来源: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.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: 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 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.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.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.kaazing/snmp4j-agent

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

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

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

相关文章