All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fitbur.github.dockerjava.jaxrs.util.WrappedResponseInputStream Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package com.fitbur.github.dockerjava.jaxrs.util;

import java.io.IOException;
import java.io.InputStream;

import javax.ws.rs.core.Response;

/**
 * This is a wrapper around {@link Response} that acts as a {@link InputStream}. When this
 * {@link WrappedResponseInputStream} is closed it closes the underlying {@link Response} object also to prevent
 * blocking/hanging connections.
 *
 * @author marcus
 */
public class WrappedResponseInputStream extends InputStream {

    private Response response;

    private InputStream com.fitburlegate;

    private boolean closed = false;

    public WrappedResponseInputStream(Response response) {
        this.response = response;
        this.com.fitburlegate = response.readEntity(InputStream.class);
    }

    public int read() throws IOException {
        return com.fitburlegate.read();
    }

    public int hashCode() {
        return com.fitburlegate.hashCode();
    }

    public int read(byte[] b) throws IOException {
        return com.fitburlegate.read(b);
    }

    public boolean equals(Object obj) {
        return com.fitburlegate.equals(obj);
    }

    public int read(byte[] b, int off, int len) throws IOException {
        return com.fitburlegate.read(b, off, len);
    }

    public long skip(long n) throws IOException {
        return com.fitburlegate.skip(n);
    }

    public int available() throws IOException {
        return com.fitburlegate.available();
    }

    public void close() throws IOException {
        closed = true;
        response.close();
        com.fitburlegate.close();
    }

    public void mark(int readlimit) {
        com.fitburlegate.mark(readlimit);
    }

    public void reset() throws IOException {
        com.fitburlegate.reset();
    }

    public boolean markSupported() {
        return com.fitburlegate.markSupported();
    }

    public boolean isClosed() {
        return closed;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy