info.freelibrary.vertx.s3.S3ClientResponseImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-s3-service Show documentation
Show all versions of vertx-s3-service Show documentation
An S3 client library for the Vert.x toolkit
package info.freelibrary.vertx.s3;
// import io.vertx.codegen.annotations.Nullable;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpClientResponse;
import io.vertx.core.streams.Pipe;
import io.vertx.core.streams.WriteStream;
/**
* A successful S3 response that provides a way to access headers and the response body.
*/
class S3ClientResponseImpl implements S3ClientResponse {
/**
* The inner HTTP client response.
*/
private final HttpClientResponse myHttpResponse;
/**
* Creates a new S3 client response from the supplied HTTP client response.
*
* @param aResponse An HTTP client response
*/
S3ClientResponseImpl(final HttpClientResponse aResponse) {
myHttpResponse = aResponse;
}
/**
* Gets the whole response body.
*
* @return The response body
*/
@Override
public Future body() {
return myHttpResponse.body();
}
/**
* Gets the whole response body using the supplied handler.
*
* @param aHandler The handler to use for getting the body
* @return The S3 client response
*/
@Override
public S3ClientResponse body(final Handler> aHandler) {
myHttpResponse.body(aHandler);
return this;
}
@Override
public S3ClientResponse handler(final Handler aHandler) {
myHttpResponse.handler(aHandler);
return this;
}
/**
* Gets the response headers.
*
* @return The response headers
*/
@Override
public HttpHeaders headers() {
return new HttpHeaders(myHttpResponse.headers());
}
@Override
public Pipe pipe() {
return myHttpResponse.pipe();
}
@Override
public Future pipeTo(final WriteStream aStream) {
return myHttpResponse.pipeTo(aStream);
}
@Override
public void pipeTo(final WriteStream aStream, final Handler> aHandler) {
myHttpResponse.pipeTo(aStream, aHandler);
}
@Override
public S3ClientResponse exceptionHandler(final Handler aHandler) {
myHttpResponse.exceptionHandler(aHandler);
return this;
}
@Override
public S3ClientResponse pause() {
myHttpResponse.pause();
return this;
}
@Override
public S3ClientResponse resume() {
myHttpResponse.resume();
return this;
}
@Override
public S3ClientResponse fetch(final long aCount) {
myHttpResponse.fetch(aCount);
return this;
}
@Override
public S3ClientResponse endHandler(final Handler aHandler) { // @Nullable final Handler aHandler) {
myHttpResponse.endHandler(aHandler);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy