Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEBUG |
private static int |
DEFAULT_POOL_SIZE |
protected HttpStack |
mHttpStack |
protected ByteArrayPool |
mPool |
private static int |
SLOW_REQUEST_THRESHOLD_MS |
Constructor and Description |
---|
BasicNetwork(HttpStack httpStack) |
BasicNetwork(HttpStack httpStack,
ByteArrayPool pool) |
Modifier and Type | Method and Description |
---|---|
private void |
addCacheHeaders(java.util.Map<java.lang.String,java.lang.String> headers,
Cache.Entry entry) |
private static void |
attemptRetryOnException(java.lang.String logPrefix,
Request<?> request,
VolleyError exception)
Attempts to prepare the request for a retry.
|
private static java.util.Map<java.lang.String,java.lang.String> |
convertHeaders(Header[] headers)
Converts Headers[] to Map
|
private byte[] |
entityToBytes(HttpEntity entity)
Reads the contents of HttpEntity into a byte[].
|
protected void |
logError(java.lang.String what,
java.lang.String url,
long start) |
private void |
logSlowRequests(long requestLifetime,
Request<?> request,
byte[] responseContents,
StatusLine statusLine)
Logs requests that took over SLOW_REQUEST_THRESHOLD_MS to complete.
|
NetworkResponse |
performRequest(Request<?> request)
Performs the specified request.
|
protected static final boolean DEBUG
private static int SLOW_REQUEST_THRESHOLD_MS
private static int DEFAULT_POOL_SIZE
protected final HttpStack mHttpStack
protected final ByteArrayPool mPool
public BasicNetwork(HttpStack httpStack)
httpStack
- HTTP stack to be usedpublic BasicNetwork(HttpStack httpStack, ByteArrayPool pool)
httpStack
- HTTP stack to be usedpool
- a buffer pool that improves GC performance in copy operationspublic NetworkResponse performRequest(Request<?> request) throws VolleyError
Network
performRequest
in interface Network
request
- Request to processNetworkResponse
with data and caching metadata; will never be nullVolleyError
- on errorsprivate void logSlowRequests(long requestLifetime, Request<?> request, byte[] responseContents, StatusLine statusLine)
private static void attemptRetryOnException(java.lang.String logPrefix, Request<?> request, VolleyError exception) throws VolleyError
request
- The request to use.VolleyError
private void addCacheHeaders(java.util.Map<java.lang.String,java.lang.String> headers, Cache.Entry entry)
protected void logError(java.lang.String what, java.lang.String url, long start)
private byte[] entityToBytes(HttpEntity entity) throws java.io.IOException, ServerError
java.io.IOException
ServerError
private static java.util.Map<java.lang.String,java.lang.String> convertHeaders(Header[] headers)