fromBytes static method
Implementation
static URIResponseRecord fromBytes({
required String name,
required int ttl,
required Uint8List bytes,
required int offset,
required int length }) {
if (length < 4 || offset + length > bytes.length) {
throw FormatException('Invalid URI record length');
}
final int priority = (bytes[offset] << 8) | bytes[offset + 1];
final int weight = (bytes[offset + 2] << 8) | bytes[offset + 3];
final String target = utf8.decode(bytes.sublist(offset + 4, offset + length));
return URIResponseRecord(
name: name,
ttl: ttl,
priority: priority,
weight: weight,
target: target);
}