public boolean equals(Object obj) { if (obj == null) return false; try { byte[] data1 = this.getBytes(); byte[] data2 = ((Address) obj).getBytes(); if ((data1[0] == data2[0]) && (data1[1] == data2[1]) && (data1[2] == data2[2]) && (data1[3] == data2[3])) return true; return false; } catch (UtilityException ue) { return false; } }
public boolean equals(Object obj) { if (obj == null) return false; try { byte[] data1 = this.getBytes(); byte[] data2 = ((Address) obj).getBytes(); if ((data1[0] == data2[0]) && (data1[1] == data2[1]) && (data1[2] == data2[2]) && (data1[3] == data2[3])) return true; return false; } catch (UtilityException ue) { return false; } }
public byte[] getBytes() throws UtilityException { byte[] result = new byte[12]; // message attribute header // type System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2); // length System.arraycopy(Utility.integerToTwoBytes(8), 0, result, 2, 2); // mappedaddress header // family result[5] = Utility.integerToOneByte(0x01); // port System.arraycopy(Utility.integerToTwoBytes(port), 0, result, 6, 2); // address System.arraycopy(address.getBytes(), 0, result, 8, 4); return result; }
public byte[] getBytes() throws UtilityException { byte[] result = new byte[12]; // message attribute header // type System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2); // length System.arraycopy(Utility.integerToTwoBytes(8), 0, result, 2, 2); // mappedaddress header // family result[5] = Utility.integerToOneByte(0x01); // port System.arraycopy(Utility.integerToTwoBytes(port), 0, result, 6, 2); // address System.arraycopy(address.getBytes(), 0, result, 8, 4); return result; }