java.lang.Object
org.minidns.record.Data
org.minidns.record.TXT
DNS TXT record payload for arbitrary text data.
Contains one or more text strings, commonly used for verification, policies, or other metadata. Each string is prefixed with a length byte.
Contains one or more text strings, commonly used for verification, policies, or other metadata. Each string is prefixed with a length byte.
Field Summary
Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionbyte[]getBlob()Get the raw wire data of this record.Get the character strings of this record, decoding each as UTF-8.List<byte[]> Get the character strings of this record as undecoded byte arrays.getText()Return the strings joined by " / ", built once and then cached.getType()Return the record type of this payload.static TXTparse(DataInputStream dis, int length) Parse a TXT record's wire data, a sequence of length-prefixed strings.voidWrite the raw wire data to a DNS output stream.toString()Return the record's text in quotes, as it appears in a zone file.Methods inherited from class Data
equals, hashCode, length, toByteArray, toOutputStream, toOutputStreamModifier and TypeMethodDescriptionfinal booleanfinal inthashCode()final intlength()Serialize this record, if that has not been done already, and report the resulting wire size.final byte[]Serialize this record, if that has not been done already, and return a copy of the result so callers cannot mutate the cached bytes.final voidWrite the binary representation of this payload to the givenDataOutputStream.final voidtoOutputStream(OutputStream outputStream) Write the binary representation to the given OutputStream.
Field Details
blob
private final byte[] blobThe record's bytes.textCache
Cache of the text of the first string.characterStringsCache
Constructor Details
TXT
public TXT(byte[] blob) Create a TXT record from its raw wire data.- Parameters:
blob- the raw TXT record data
Method Details
parse
Parse a TXT record's wire data, a sequence of length-prefixed strings.- Parameters:
dis- the stream positioned at the start of the record datalength- how many bytes of record data to read- Returns:
- a TXT record holding those bytes
- Throws:
IOException- if the stream ends before length bytes have been read
getBlob
public byte[] getBlob()Get the raw wire data of this record.- Returns:
- copy of the raw blob data
getText
Return the strings joined by " / ", built once and then cached.- Returns:
- the character strings joined by " / ", built once and then cached
getCharacterStrings
getExtents
Get the character strings of this record as undecoded byte arrays.- Returns:
- individual character strings as raw byte arrays
serialize
Write the raw wire data to a DNS output stream.- Specified by:
serializein classData- Parameters:
dos- the output stream to serialize to.- Throws:
IOException- if an I/O error occurs.
getType
Return the record type of this payload.toString