@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof /*OFMessage*/ SNMPMessage)) { return false; } /*OFMessage*/ SNMPMessage other = (/*OFMessage*/ SNMPMessage) obj; if (length != other.length) { return false; } if (type == null) { if (other.type != null) { return false; } } else if (!type.equals(other.type)) { return false; } if (version != other.version) { return false; } if (xid != other.xid) { return false; } return true; }
@Override public int hashCode() { final int prime = 97; int result = 1; result = prime * result + length; result = prime * result + ((type == null) ? 0 : type.hashCode()); result = prime * result + version; result = prime * result + xid; return result; }
/** * Write this message's binary format to the specified ByteBuffer * * @param data */ public void writeTo(ByteBuffer data) { data.put(version); data.put(type.getTypeValue()); data.putShort(length); data.putInt(xid); }
/** * Read this message off the wire from the specified ByteBuffer * * @param data */ public void readFrom(ByteBuffer data) { this.version = data.get(); this.type = /*OFType*/ SNMPType.valueOf(data.get()); this.length = data.getShort(); this.xid = data.getInt(); }