static EDNSOption
fromWire(DNSInput in) throws IOException {
	int code, length;

	code = in.readU16();
	length = in.readU16();
	if (in.remaining() < length)
		throw new WireParseException("truncated option");
	int save = in.saveActive();
	in.setActive(length);
	EDNSOption option;
	switch (code) {
	case Code.NSID:
		option = new NSIDOption();
		break;
	case Code.CLIENT_SUBNET:
		option = new ClientSubnetOption();
		break;
	default:
		option = new GenericEDNSOption(code);
		break;
	}
	option.optionFromWire(in);
	in.restoreActive(save);

	return option;
}
Converts the wire format of an EDNS Option (including code and length) into
the type-specific format.
@param out The input stream.
src/main/java/core/org/xbill/DNS/EDNSOption.java