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:
- Closeable
- Enclosing class:
- BodyDeferringAsyncHandler
public static class BodyDeferringAsyncHandler.BodyDeferringInputStream
- extends 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BodyDeferringAsyncHandler.BodyDeferringInputStream
public BodyDeferringAsyncHandler.BodyDeferringInputStream(Future<Response> future,
BodyDeferringAsyncHandler bdah,
InputStream in)
close
public void close()
throws 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 Closeable
- Overrides:
close
in class FilterInputStream
- Throws:
IOException
getAsapResponse
public Response getAsapResponse()
throws InterruptedException,
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:
InterruptedException
IOException
getLastResponse
public Response getLastResponse()
throws InterruptedException,
ExecutionException
- Delegates to
Future#get()
method. Will block
as long as complete response arrives.
- Returns:
- a
Response
- Throws:
InterruptedException
ExecutionException
Copyright © 2011. All Rights Reserved.