com.ning.http.client
Class BodyDeferringAsyncHandler.BodyDeferringInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.ning.http.client.BodyDeferringAsyncHandler.BodyDeferringInputStream
- All Implemented Interfaces:
- java.io.Closeable
- Enclosing class:
- BodyDeferringAsyncHandler
public static class BodyDeferringAsyncHandler.BodyDeferringInputStream
- extends java.io.FilterInputStream
A simple helper class that is used to perform automatic "join" for async
download and the error checking of the Future of the request.
Fields inherited from class java.io.FilterInputStream |
in |
Methods inherited from class java.io.FilterInputStream |
available, mark, markSupported, read, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BodyDeferringAsyncHandler.BodyDeferringInputStream
public BodyDeferringAsyncHandler.BodyDeferringInputStream(java.util.concurrent.Future<Response> future,
BodyDeferringAsyncHandler bdah,
java.io.InputStream in)
close
public void close()
throws java.io.IOException
- Closes the input stream, and "joins" (wait for complete execution
together with potential exception thrown) of the async request.
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.FilterInputStream
- Throws:
java.io.IOException
getAsapResponse
public Response getAsapResponse()
throws java.lang.InterruptedException,
java.io.IOException
- Delegates to
BodyDeferringAsyncHandler.getResponse()
. Will
blocks as long as headers arrives only. Might return
null
. See
BodyDeferringAsyncHandler.getResponse()
method for details.
- Returns:
- a
Response
- Throws:
java.lang.InterruptedException
java.io.IOException
getLastResponse
public Response getLastResponse()
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
- Delegates to
Future#get()
method. Will block
as long as complete response arrives.
- Returns:
- a
Response
- Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
Copyright © 2011. All Rights Reserved.