Package io.netty.handler.codec.dns
Class DnsCodecUtil
- java.lang.Object
-
- io.netty.handler.codec.dns.DnsCodecUtil
-
final class DnsCodecUtil extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intMAX_COMPRESSION_POINTERS(package private) static intMAX_DOMAIN_NAME_LENGTH(package private) static intMAX_RECORDS_PER_SECTION
-
Constructor Summary
Constructors Modifier Constructor Description privateDnsCodecUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static intcalculateMaxNameLength(int readable)Returns the initial capacity to use for theStringBuilderthat accumulates a decoded domain name.(package private) static intcheckRecordCount(DnsSection section, int count)Ensures the record count of a section, as announced in the header of a DNS message, does not exceedMAX_RECORDS_PER_SECTION.(package private) static java.lang.StringdecodeDomainName(ByteBuf in)(package private) static ByteBufdecompressDomainName(ByteBuf compression)Decompress pointer data.(package private) static voidencodeDomainName(java.lang.String name, ByteBuf buf)
-
-
-
Field Detail
-
MAX_DOMAIN_NAME_LENGTH
static final int MAX_DOMAIN_NAME_LENGTH
- See Also:
- Constant Field Values
-
MAX_COMPRESSION_POINTERS
static final int MAX_COMPRESSION_POINTERS
- See Also:
- Constant Field Values
-
MAX_RECORDS_PER_SECTION
static final int MAX_RECORDS_PER_SECTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
encodeDomainName
static void encodeDomainName(java.lang.String name, ByteBuf buf)
-
calculateMaxNameLength
static int calculateMaxNameLength(int readable)
Returns the initial capacity to use for theStringBuilderthat accumulates a decoded domain name. A decoded name can never exceedMAX_DOMAIN_NAME_LENGTHcharacters (see the check indecodeDomainName(ByteBuf)), so the capacity must not scale withreadable, the number of bytes left in the whole message: doing so would let a message with a huge amount of trailing data (e.g. many more records after this name) force an oversized allocation for every single name decoded from it.
-
checkRecordCount
static int checkRecordCount(DnsSection section, int count)
Ensures the record count of a section, as announced in the header of a DNS message, does not exceedMAX_RECORDS_PER_SECTION.- Throws:
TooLongFrameException- if the count is too large.
-
decodeDomainName
static java.lang.String decodeDomainName(ByteBuf in)
-
-