本文整理汇总了Java中org.snmp4j.smi.OID.size方法的典型用法代码示例。如果您正苦于以下问题:Java OID.size方法的具体用法?Java OID.size怎么用?Java OID.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.snmp4j.smi.OID
的用法示例。
在下文中一共展示了OID.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkWalkFinished
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
private static boolean checkWalkFinished(OID targetOID, PDU pdu, VariableBinding vb) {
boolean finished = false;
if (pdu.getErrorStatus() != 0) {
finished = true;
} else if (vb.getOid() == null) {
finished = true;
} else if (vb.getOid().size() < targetOID.size()) {
finished = true;
} else if (targetOID.leftMostCompare(targetOID.size(), vb.getOid()) != 0) {
finished = true;
} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
finished = true;
} else if (vb.getOid().compareTo(targetOID) <= 0) {
finished = true;
}
return finished;
}
示例2: checkWalkFinished
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
private static boolean checkWalkFinished(OID targetOID, PDU pdu,
VariableBinding vb) {
boolean finished = false;
if (pdu.getErrorStatus() != 0) {
System.out.println("[true] responsePDU.getErrorStatus() != 0 ");
System.out.println(pdu.getErrorStatusText());
finished = true;
} else if (vb.getOid() == null) {
System.out.println("[true] vb.getOid() == null");
finished = true;
} else if (vb.getOid().size() < targetOID.size()) {
System.out.println("[true] vb.getOid().size() < targetOID.size()");
finished = true;
} else if (targetOID.leftMostCompare(targetOID.size(), vb.getOid()) != 0) {
System.out.println("[true] targetOID.leftMostCompare() != 0");
finished = true;
} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
System.out
.println("[true] Null.isExceptionSyntax(vb.getVariable().getSyntax())");
finished = true;
} else if (vb.getOid().compareTo(targetOID) <= 0) {
System.out.println("[true] Variable received is not "
+ "lexicographic successor of requested " + "one:");
System.out.println(vb.toString() + " <= " + targetOID);
finished = true;
}
return finished;
}
示例3: checkWalkFinished
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
private static boolean checkWalkFinished(OID walkOID, PDU pdu,
VariableBinding vb) {
boolean finished = false;
if (pdu.getErrorStatus() != 0) {
System.out.println("[true] pdu.getErrorStatus() != 0 ");
System.out.println(pdu.getErrorStatusText());
finished = true;
} else if (vb.getOid() == null) {
System.out.println("[true] vb.getOid() == null");
finished = true;
} else if (vb.getOid().size() < walkOID.size()) {
System.out.println("[true] vb.getOid().size() < targetOID.size()");
finished = true;
} else if (walkOID.leftMostCompare(walkOID.size(), vb.getOid()) != 0) {
System.out.println("[true] targetOID.leftMostCompare() != 0");
finished = true;
} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
System.out
.println("[true] Null.isExceptionSyntax(vb.getVariable().getSyntax())");
finished = true;
} else if (vb.getOid().compareTo(walkOID) <= 0) {
System.out.println("[true] vb.getOid().compareTo(walkOID) <= 0 ");
finished = true;
}
return finished;
}
示例4: checkWalkFinished
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
/**
* 1)responsePDU == null<br>
* 2)responsePDU.getErrorStatus() != 0<br>
* 3)responsePDU.get(0).getOid() == null<br>
* 4)responsePDU.get(0).getOid().size() < targetOID.size()<br>
* 5)targetOID.leftMostCompare(targetOID.size(),responsePDU.get(0).getOid())
* !=0<br>
* 6)Null.isExceptionSyntax(responsePDU.get(0).getVariable().getSyntax())<br>
* 7)responsePDU.get(0).getOid().compareTo(targetOID) <= 0<br>
*
* @param targetOID
* @param pdu
* @param vb
* @return
*/
private static boolean checkWalkFinished(OID targetOID, PDU pdu,
VariableBinding vb) {
boolean finished = false;
if (pdu.getErrorStatus() != 0) {
System.out.println("[true] responsePDU.getErrorStatus() != 0 ");
System.out.println(pdu.getErrorStatusText());
finished = true;
} else if (vb.getOid() == null) {
System.out.println("[true] vb.getOid() == null");
finished = true;
} else if (vb.getOid().size() < targetOID.size()) {
System.out.println("[true] vb.getOid().size() < targetOID.size()");
finished = true;
} else if (targetOID.leftMostCompare(targetOID.size(), vb.getOid()) != 0) {
System.out.println("[true] targetOID.leftMostCompare() != 0");
finished = true;
} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
System.out
.println("[true] Null.isExceptionSyntax(vb.getVariable().getSyntax())");
finished = true;
} else if (vb.getOid().compareTo(targetOID) <= 0) {
System.out.println("[true] Variable received is not "
+ "lexicographic successor of requested " + "one:");
System.out.println(vb.toString() + " <= " + targetOID);
finished = true;
}
return finished;
}
示例5: toName
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
/**
* Inverse operation of {@link #toOid(String)}.
* Returns the exact matching name part suffixed with the remainder OID.
*/
public String toName(OID oid) {
if (oid == null)
throw new NullPointerException("value");
String name = this.oids.get(oid);
if (name != null)
return name;
Entry<OID, String> lowerEntry = this.oids.lowerEntry(oid);
if (lowerEntry != null && oid.startsWith(lowerEntry.getKey())) {
OID parent = lowerEntry.getKey();
OID suffix = new OID(oid.getValue(), parent.size(), oid.size() - parent.size());
return lowerEntry.getValue() + "." + suffix;
}
return oid.toString();
}
示例6: walk
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
public static List<VariableBinding> walk(Target target, OID oid) {
List<VariableBinding> ret = new ArrayList<VariableBinding>();
PDU requestPDU = new PDU();
requestPDU.add(new VariableBinding(oid));
requestPDU.setType(PDU.GETNEXT);
boolean finished = false;
try{
while (!finished) {
VariableBinding vb = null;
ResponseEvent respEvt = snmp.send(requestPDU, target);
PDU responsePDU = respEvt.getResponse();
if (responsePDU != null) {
vb = responsePDU.get(0);
}
if (responsePDU == null) {
finished = true;
} else if (responsePDU.getErrorStatus() != 0) {
finished = true;
} else if (vb.getOid() == null) {
finished = true;
} else if (vb.getOid().size() < oid.size()) {
finished = true;
} else if (oid.leftMostCompare(oid.size(), vb.getOid()) != 0) {
finished = true;
} else if (Null.isExceptionSyntax(vb.getVariable().getSyntax())) {
finished = true;
} else if (vb.getOid().compareTo(oid) <= 0) {
finished = true;
} else {
ret.add(vb);
// Set up the variable binding for the next entry.
requestPDU.setRequestID(new Integer32(0));
requestPDU.set(0, vb);
}
}
} catch (IOException e) {
e.printStackTrace();
}
return ret;
}
示例7: matches
import org.snmp4j.smi.OID; //导入方法依赖的package包/类
/**
* Returns {@code true} if this wildcard {@code OID} matches with the specified {@code OID}.
* <p/>
* Here some examples for matching {@code OID}s:
* <ul>
* <li>{@code .1.3.3.*.7} and {@code .1.3.3.7}</li>
* <li>{@code .1.3.3.*.7} and {@code .1.3.3.3.7}</li>
* <li>{@code .1.3.3.*.7} and {@code .1.3.3.1.2.3.4.5.7}</li>
* </ul>
*
* @param oid the {@code OID} to test
* @return {@code true} if the {@code OID}s are matching, otherwise {@code false}
*/
public boolean matches(final OID oid) {
return oid.startsWith(startsWith) && (endsWith == null || oid.size() >= endsWith.size() && oid.rightMostCompare(endsWith.size(), endsWith) == 0);
}