summaryrefslogtreecommitdiff
path: root/core/java/android/net/DnsPacket.java
diff options
context:
space:
mode:
authorLuke Huang <huangluke@google.com>2019-03-04 17:08:03 +0800
committerLuke Huang <huangluke@google.com>2019-03-16 18:53:05 +0800
commit304491dba8594a88aa1586a30a21fcebc67a23a6 (patch)
tree91c4977b5dbc541c35fa82b8412747705e28a041 /core/java/android/net/DnsPacket.java
parent1276a178fd24f42d3c4bcbd44894c2c27ec3b478 (diff)
Refactor answer callback for async DNS query JAVA API
1. refactor AnswerCallback with a generic type 2. support onError in AnswerCallback 3. Fix minor problem reported from API Review Bug: 124882626 Test: built, flashed, booted atest DnsResolverTest DnsPacketTest Change-Id: I685c9989f8401acb63d2e83f552b2d5b20c41af0
Diffstat (limited to 'core/java/android/net/DnsPacket.java')
-rw-r--r--core/java/android/net/DnsPacket.java17
1 files changed, 4 insertions, 13 deletions
diff --git a/core/java/android/net/DnsPacket.java b/core/java/android/net/DnsPacket.java
index 0ac02b1b7b37..83e57e0a047b 100644
--- a/core/java/android/net/DnsPacket.java
+++ b/core/java/android/net/DnsPacket.java
@@ -71,7 +71,7 @@ public abstract class DnsPacket {
}
/**
- * It's used both for DNS questions and DNS resource records.
+ * Superclass for DNS questions and DNS resource records.
*
* DNS questions (No TTL/RDATA)
* DNS resource records (With TTL/RDATA)
@@ -96,12 +96,13 @@ public abstract class DnsPacket {
/**
* Create a new DnsRecord from a positioned ByteBuffer.
*
- * @param ByteBuffer input of record, must be in network byte order
- * (which is the default).
* Reads the passed ByteBuffer from its current position and decodes a DNS record.
* When this constructor returns, the reading position of the ByteBuffer has been
* advanced to the end of the DNS header record.
* This is meant to chain with other methods reading a DNS response in sequence.
+ *
+ * @param ByteBuffer input of record, must be in network byte order
+ * (which is the default).
*/
DnsRecord(int recordType, @NonNull ByteBuffer buf)
throws BufferUnderflowException, ParseException {
@@ -205,16 +206,6 @@ public abstract class DnsPacket {
protected final DnsHeader mHeader;
protected final List<DnsRecord>[] mRecords;
- public static class ParseException extends Exception {
- public ParseException(String msg) {
- super(msg);
- }
-
- public ParseException(String msg, Throwable cause) {
- super(msg, cause);
- }
- }
-
protected DnsPacket(@NonNull byte[] data) throws ParseException {
if (null == data) throw new ParseException("Parse header failed, null input data");
final ByteBuffer buffer;