Package 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,AutoCloseable
- Enclosing class:
- BodyDeferringAsyncHandler
A simple helper class that is used to perform automatic "join" for async
download and the error checking of the Future of the request.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionBodyDeferringInputStream(Future<Response> future, BodyDeferringAsyncHandler bdah, InputStream in) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the input stream, and "joins" (wait for complete execution together with potential exception thrown) of the async request.Delegates toBodyDeferringAsyncHandler.getResponse().Delegates toFuturemethod.#get() Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, read, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
BodyDeferringInputStream
public BodyDeferringInputStream(Future<Response> future, BodyDeferringAsyncHandler bdah, InputStream in)
-
-
Method Details
-
close
Closes the input stream, and "joins" (wait for complete execution together with potential exception thrown) of the async request.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
getAsapResponse
Delegates toBodyDeferringAsyncHandler.getResponse(). Will blocks as long as headers arrives only. Might returnnull. SeeBodyDeferringAsyncHandler.getResponse()method for details.- Returns:
- a
Response - Throws:
InterruptedExceptionIOException
-
getLastResponse
Delegates toFuturemethod. Will block as long as complete response arrives.#get() - Returns:
- a
Response - Throws:
InterruptedExceptionExecutionException
-