
net.lightbody.bmp.proxy.util.ClonedInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of browsermob-proxy Show documentation
Show all versions of browsermob-proxy Show documentation
A programmatic HTTP/S designed for performance and functional testing
package net.lightbody.bmp.proxy.util;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class ClonedInputStream extends InputStream {
private InputStream is;
private ByteArrayOutputStream os = new ByteArrayOutputStream();
public ClonedInputStream(InputStream is) {
this.is = is;
}
public int read() throws IOException {
int resp = is.read();
os.write(resp);
return resp;
}
public int read(byte[] b) throws IOException {
int resp = is.read(b);
os.write(b);
return resp;
}
public int read(byte[] b, int off, int len) throws IOException {
int resp = is.read(b, off, len);
os.write(b, off, len);
return resp;
}
public long skip(long n) throws IOException {
return is.skip(n);
}
public int available() throws IOException {
return is.available();
}
public void close() throws IOException {
os.close();
is.close();
}
public void mark(int readlimit) {
is.mark(readlimit);
}
public void reset() throws IOException {
os.reset();
is.reset();
}
public boolean markSupported() {
return is.markSupported();
}
public ByteArrayOutputStream getOutput() {
return os;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy