This is a very naive implementation and lacks support for services other than address lookup (Type=A) and pointer look up (Type=Ptr). Because I haven't found a service that used inverse querying for name look up, only pointer look up is implemented.
Exceptions will not occur when parsing byte arrays, only when attempting to create from scratch new packets with unsupported Types.
A Dns packet ... 1 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ID | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |QR| Opcode |AA|TC|RD|RA| Z | RCODE | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | QDCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ANCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | NSCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | ARCOUNT | +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | QueryS / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | | RESPONSES / / +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+