private IllegalIpV4Option(byte[] rawData, int offset, int length) { this.type = IpV4OptionType.getInstance(rawData[offset]); this.rawData = new byte[length]; System.arraycopy(rawData, offset, this.rawData, 0, length); }
private UnknownIpV4Option(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < 2) { StringBuilder sb = new StringBuilder(100); sb.append("The raw data length must be more than 1. rawData: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.type = IpV4OptionType.getInstance(rawData[offset]); this.length = rawData[1 + offset]; int lengthFieldAsInt = getLengthAsInt(); if (length < lengthFieldAsInt) { StringBuilder sb = new StringBuilder(100); sb.append("The raw data is too short to build this option (") .append(lengthFieldAsInt) .append("). data: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.data = ByteArrays.getSubArray(rawData, 2 + offset, lengthFieldAsInt - 2); }
try { while (currentOffsetInHeader < headerLength) { IpV4OptionType type = IpV4OptionType.getInstance(rawData[currentOffsetInHeader + offset]); IpV4Option newOne; newOne =
private IllegalIpV4Option(byte[] rawData, int offset, int length) { this.type = IpV4OptionType.getInstance(rawData[offset]); this.rawData = new byte[length]; System.arraycopy(rawData, offset, this.rawData, 0, length); }
private UnknownIpV4Option(byte[] rawData, int offset, int length) throws IllegalRawDataException { if (length < 2) { StringBuilder sb = new StringBuilder(100); sb.append("The raw data length must be more than 1. rawData: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.type = IpV4OptionType.getInstance(rawData[offset]); this.length = rawData[1 + offset]; int lengthFieldAsInt = getLengthAsInt(); if (length < lengthFieldAsInt) { StringBuilder sb = new StringBuilder(100); sb.append("The raw data is too short to build this option (") .append(lengthFieldAsInt) .append("). data: ") .append(ByteArrays.toHexString(rawData, " ")) .append(", offset: ") .append(offset) .append(", length: ") .append(length); throw new IllegalRawDataException(sb.toString()); } this.data = ByteArrays.getSubArray(rawData, 2 + offset, lengthFieldAsInt - 2); }
try { while (currentOffsetInHeader < headerLength) { IpV4OptionType type = IpV4OptionType.getInstance(rawData[currentOffsetInHeader + offset]); IpV4Option newOne; newOne =