
org.testifyproject.github.dockerjava.jaxrs.util.WrappedResponseInputStream Maven / Gradle / Ivy
package org.testifyproject.testifyproject.github.dockerjava.jaxrs.util;
import java.org.testifyproject.testifyproject.IOException;
import java.org.testifyproject.testifyproject.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 Linke
*/
public class WrappedResponseInputStream extends InputStream {
private Response response;
private InputStream org.testifyproject.testifyprojectlegate;
private boolean closed = false;
public WrappedResponseInputStream(Response response) {
this.response = response;
this.org.testifyproject.testifyprojectlegate = response.readEntity(InputStream.class);
}
public int read() throws IOException {
return org.testifyproject.testifyprojectlegate.read();
}
public int hashCode() {
return org.testifyproject.testifyprojectlegate.hashCode();
}
public int read(byte[] b) throws IOException {
return org.testifyproject.testifyprojectlegate.read(b);
}
public boolean equals(Object obj) {
return org.testifyproject.testifyprojectlegate.equals(obj);
}
public int read(byte[] b, int off, int len) throws IOException {
return org.testifyproject.testifyprojectlegate.read(b, off, len);
}
public long skip(long n) throws IOException {
return org.testifyproject.testifyprojectlegate.skip(n);
}
public int available() throws IOException {
return org.testifyproject.testifyprojectlegate.available();
}
public void close() throws IOException {
closed = true;
response.close();
org.testifyproject.testifyprojectlegate.close();
}
public void mark(int readlimit) {
org.testifyproject.testifyprojectlegate.mark(readlimit);
}
public void reset() throws IOException {
org.testifyproject.testifyprojectlegate.reset();
}
public boolean markSupported() {
return org.testifyproject.testifyprojectlegate.markSupported();
}
public boolean isClosed() {
return closed;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy