java.lang.Object
org.minidns.edns.EdnsOption
- Direct Known Subclasses:
Nsid, UnknownEdnsOption
Abstract base class for EDNS options.
Field Summary
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEdnsOption(byte[] optionData) Build an option whose code is taken from the subclass's option code.protectedEdnsOption(int optionCode, byte[] optionData) Creates a new EDNS option with the specified option code and data.Method Summary
Modifier and TypeMethodDescriptionfinal StringReturns the terminal output representation of this EDNS option.protected abstract CharSequenceReturns the terminal output representation of this EDNS option.abstract Edns.OptionCodeReturns the option code for this EDNS option.static EdnsOptionparse(int intOptionCode, byte[] optionData) Parses an EDNS option from the specified option code and data.final StringtoString()Returns the cached string form, computing it fromtoStringInternal()on first use.protected abstract CharSequenceReturns the string representation of this EDNS option.final voidWrites this EDNS option to the specified data output stream.
Field Details
optionCode
public final int optionCodeThe EDNS option code.optionLength
public final int optionLengthThe length of the option data.optionData
protected final byte[] optionDataThe raw option data.toStringCache
The rendered form, computed once and kept.terminalOutputCache
The terminal-rendered form, computed once and kept.
Constructor Details
EdnsOption
protected EdnsOption(int optionCode, byte[] optionData) Creates a new EDNS option with the specified option code and data.- Parameters:
optionCode- the option codeoptionData- the option data
EdnsOption
protected EdnsOption(byte[] optionData) Build an option whose code is taken from the subclass's option code.- Parameters:
optionData- the raw option payload; its length becomes the option length
Method Details
writeToDos
Writes this EDNS option to the specified data output stream.- Parameters:
dos- the data output stream to write to- Throws:
IOException- if an I/O error occurs
getOptionCode
Returns the option code for this EDNS option.- Returns:
- the option code
toString
Returns the cached string form, computing it fromtoStringInternal()on first use.toStringInternal
Returns the string representation of this EDNS option.- Returns:
- the string representation
asTerminalOutput
Returns the terminal output representation of this EDNS option.- Returns:
- the terminal output representation
asTerminalOutputInternal
Returns the terminal output representation of this EDNS option.- Returns:
- the terminal output representation
parse
Parses an EDNS option from the specified option code and data.- Parameters:
intOptionCode- the option code as an integeroptionData- the option data- Returns:
- the parsed EDNS option