aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/android/volley/NetworkResponse.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/android/volley/NetworkResponse.java')
-rw-r--r--src/main/java/com/android/volley/NetworkResponse.java65
1 files changed, 45 insertions, 20 deletions
diff --git a/src/main/java/com/android/volley/NetworkResponse.java b/src/main/java/com/android/volley/NetworkResponse.java
index f0fded3..01f48c6 100644
--- a/src/main/java/com/android/volley/NetworkResponse.java
+++ b/src/main/java/com/android/volley/NetworkResponse.java
@@ -23,80 +23,106 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-/**
- * Data and headers returned from {@link Network#performRequest(Request)}.
- */
+/** Data and headers returned from {@link Network#performRequest(Request)}. */
public class NetworkResponse {
/**
* Creates a new network response.
+ *
* @param statusCode the HTTP status code
* @param data Response body
* @param headers Headers returned with this response, or null for none
* @param notModified True if the server returned a 304 and the data was already in cache
* @param networkTimeMs Round-trip network time to receive network response
* @deprecated see {@link #NetworkResponse(int, byte[], boolean, long, List)}. This constructor
- * cannot handle server responses containing multiple headers with the same name.
- * This constructor may be removed in a future release of Volley.
+ * cannot handle server responses containing multiple headers with the same name. This
+ * constructor may be removed in a future release of Volley.
*/
@Deprecated
- public NetworkResponse(int statusCode, byte[] data, Map<String, String> headers,
- boolean notModified, long networkTimeMs) {
+ public NetworkResponse(
+ int statusCode,
+ byte[] data,
+ Map<String, String> headers,
+ boolean notModified,
+ long networkTimeMs) {
this(statusCode, data, headers, toAllHeaderList(headers), notModified, networkTimeMs);
}
/**
* Creates a new network response.
+ *
* @param statusCode the HTTP status code
* @param data Response body
* @param notModified True if the server returned a 304 and the data was already in cache
* @param networkTimeMs Round-trip network time to receive network response
* @param allHeaders All headers returned with this response, or null for none
*/
- public NetworkResponse(int statusCode, byte[] data, boolean notModified, long networkTimeMs,
+ public NetworkResponse(
+ int statusCode,
+ byte[] data,
+ boolean notModified,
+ long networkTimeMs,
List<Header> allHeaders) {
this(statusCode, data, toHeaderMap(allHeaders), allHeaders, notModified, networkTimeMs);
}
/**
* Creates a new network response.
+ *
* @param statusCode the HTTP status code
* @param data Response body
* @param headers Headers returned with this response, or null for none
* @param notModified True if the server returned a 304 and the data was already in cache
* @deprecated see {@link #NetworkResponse(int, byte[], boolean, long, List)}. This constructor
- * cannot handle server responses containing multiple headers with the same name.
- * This constructor may be removed in a future release of Volley.
+ * cannot handle server responses containing multiple headers with the same name. This
+ * constructor may be removed in a future release of Volley.
*/
@Deprecated
- public NetworkResponse(int statusCode, byte[] data, Map<String, String> headers,
- boolean notModified) {
- this(statusCode, data, headers, notModified, 0);
+ public NetworkResponse(
+ int statusCode, byte[] data, Map<String, String> headers, boolean notModified) {
+ this(statusCode, data, headers, notModified, /* networkTimeMs= */ 0);
}
/**
* Creates a new network response for an OK response with no headers.
+ *
* @param data Response body
*/
public NetworkResponse(byte[] data) {
- this(HttpURLConnection.HTTP_OK, data, false, 0, Collections.<Header>emptyList());
+ this(
+ HttpURLConnection.HTTP_OK,
+ data,
+ /* notModified= */ false,
+ /* networkTimeMs= */ 0,
+ Collections.<Header>emptyList());
}
/**
* Creates a new network response for an OK response.
+ *
* @param data Response body
* @param headers Headers returned with this response, or null for none
* @deprecated see {@link #NetworkResponse(int, byte[], boolean, long, List)}. This constructor
- * cannot handle server responses containing multiple headers with the same name.
- * This constructor may be removed in a future release of Volley.
+ * cannot handle server responses containing multiple headers with the same name. This
+ * constructor may be removed in a future release of Volley.
*/
@Deprecated
public NetworkResponse(byte[] data, Map<String, String> headers) {
- this(HttpURLConnection.HTTP_OK, data, headers, false, 0);
+ this(
+ HttpURLConnection.HTTP_OK,
+ data,
+ headers,
+ /* notModified= */ false,
+ /* networkTimeMs= */ 0);
}
- private NetworkResponse(int statusCode, byte[] data, Map<String, String> headers,
- List<Header> allHeaders, boolean notModified, long networkTimeMs) {
+ private NetworkResponse(
+ int statusCode,
+ byte[] data,
+ Map<String, String> headers,
+ List<Header> allHeaders,
+ boolean notModified,
+ long networkTimeMs) {
this.statusCode = statusCode;
this.data = data;
this.headers = headers;
@@ -164,4 +190,3 @@ public class NetworkResponse {
return allHeaders;
}
}
-