public byte[] getBytes() throws UtilityException { byte[] result = new byte[4]; result[0] = Utility.integerToOneByte(firstOctet); result[1] = Utility.integerToOneByte(secondOctet); result[2] = Utility.integerToOneByte(thirdOctet); result[3] = Utility.integerToOneByte(fourthOctet); return result; }
public byte[] getBytes() throws UtilityException { byte[] result = new byte[4]; result[0] = Utility.integerToOneByte(firstOctet); result[1] = Utility.integerToOneByte(secondOctet); result[2] = Utility.integerToOneByte(thirdOctet); result[3] = Utility.integerToOneByte(fourthOctet); return result; }
public InetAddress getInetAddress() throws UtilityException, UnknownHostException { byte[] address = new byte[4]; address[0] = Utility.integerToOneByte(firstOctet); address[1] = Utility.integerToOneByte(secondOctet); address[2] = Utility.integerToOneByte(thirdOctet); address[3] = Utility.integerToOneByte(fourthOctet); return InetAddress.getByAddress(address); }
public InetAddress getInetAddress() throws UtilityException, UnknownHostException { byte[] address = new byte[4]; address[0] = Utility.integerToOneByte(firstOctet); address[1] = Utility.integerToOneByte(secondOctet); address[2] = Utility.integerToOneByte(thirdOctet); address[3] = Utility.integerToOneByte(fourthOctet); return InetAddress.getByAddress(address); }
public byte[] getBytes() throws UtilityException { byte[] result = new byte[8]; // message attribute header // type System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2); // length System.arraycopy(Utility.integerToTwoBytes(4), 0, result, 2, 2); // change request header if (changeIP) result[7] = Utility.integerToOneByte(4); if (changePort) result[7] = Utility.integerToOneByte(2); if (changeIP && changePort) result[7] = Utility.integerToOneByte(6); return result; }
public byte[] getBytes() throws UtilityException { byte[] result = new byte[8]; // message attribute header // type System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2); // length System.arraycopy(Utility.integerToTwoBytes(4), 0, result, 2, 2); // change request header if (changeIP) result[7] = Utility.integerToOneByte(4); if (changePort) result[7] = Utility.integerToOneByte(2); if (changeIP && changePort) result[7] = Utility.integerToOneByte(6); return result; }
public byte[] getBytes() throws UtilityException { int length = reason.length(); // length adjustment if ((length % 4) != 0) { length += 4 - (length % 4); } // message attribute header length += 4; byte[] result = new byte[length]; // message attribute header // type System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2); // length System.arraycopy(Utility.integerToTwoBytes(length-4), 0, result, 2, 2); // error code header int classHeader = (int) Math.floor(((double)responseCode)/100); result[6] = Utility.integerToOneByte(classHeader); result[7] = Utility.integerToOneByte(responseCode%100); byte[] reasonArray = reason.getBytes(); System.arraycopy(reasonArray, 0, result, 8, reasonArray.length); return result; }
public byte[] getBytes() throws UtilityException { int length = reason.length(); // length adjustment if ((length % 4) != 0) { length += 4 - (length % 4); } // message attribute header length += 4; byte[] result = new byte[length]; // message attribute header // type System.arraycopy(Utility.integerToTwoBytes(typeToInteger(type)), 0, result, 0, 2); // length System.arraycopy(Utility.integerToTwoBytes(length-4), 0, result, 2, 2); // error code header int classHeader = (int) Math.floor(((double)responseCode)/100); result[6] = Utility.integerToOneByte(classHeader); result[7] = Utility.integerToOneByte(responseCode%100); byte[] reasonArray = reason.getBytes(); System.arraycopy(reasonArray, 0, result, 8, reasonArray.length); 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; }
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; }