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

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

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

OID.removeLast介绍

[英]Removes the last sub-identifier (if available) from this OIDand returns it.
[中]从该文件中删除最后一个子标识符(如果可用),并返回它。

代码示例

代码示例来源: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.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.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;
 }
}

相关文章