/** * @return The HostAddrType for this instance */ public HostAddrType getAddrType() { Integer value = getFieldAsInteger(HostAddressField.ADDR_TYPE); return HostAddrType.fromValue(value); }
/** * @return The HostAddrType for this instance */ public HostAddrType getAddrType() { Integer value = getFieldAsInteger(HostAddressField.ADDR_TYPE); return HostAddrType.fromValue(value); }
public HostAddress readAddress() throws IOException { int typeValue = readShort(); HostAddrType addrType = HostAddrType.fromValue(typeValue); if (addrType == HostAddrType.NONE) { throw new IOException("Invalid host address type"); } byte[] addrData = readCountedOctets(); if (addrData == null) { throw new IOException("Invalid host address data"); } HostAddress addr = new HostAddress(); addr.setAddrType(addrType); addr.setAddress(addrData); return addr; }
public HostAddress readAddress() throws IOException { int typeValue = readShort(); HostAddrType addrType = HostAddrType.fromValue(typeValue); if (addrType == HostAddrType.NONE) { throw new IOException("Invalid host address type"); } byte[] addrData = readCountedOctets(); if (addrData == null) { throw new IOException("Invalid host address data"); } HostAddress addr = new HostAddress(); addr.setAddrType(addrType); addr.setAddress(addrData); return addr; }