This commit is contained in:
parent
703c69b055
commit
32f65a506e
@ -8,6 +8,7 @@ import java.io.OutputStream;
|
|||||||
*/
|
*/
|
||||||
public class FlushyOutputStream extends OutputStream {
|
public class FlushyOutputStream extends OutputStream {
|
||||||
private OutputStream base;
|
private OutputStream base;
|
||||||
|
private boolean isClosed = false;
|
||||||
|
|
||||||
public FlushyOutputStream(OutputStream base) {
|
public FlushyOutputStream(OutputStream base) {
|
||||||
this.base = base;
|
this.base = base;
|
||||||
@ -15,19 +16,27 @@ public class FlushyOutputStream extends OutputStream {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) throws IOException {
|
||||||
|
if(isClosed) return;
|
||||||
base.write(b);
|
base.write(b);
|
||||||
base.flush();
|
base.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b) throws IOException {
|
public void write(byte[] b) throws IOException {
|
||||||
|
if(isClosed) return;
|
||||||
base.write(b);
|
base.write(b);
|
||||||
base.flush();
|
base.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b, int off, int len) throws IOException {
|
public void write(byte[] b, int off, int len) throws IOException {
|
||||||
|
if(isClosed) return;
|
||||||
base.write(b, off, len);
|
base.write(b, off, len);
|
||||||
base.flush();
|
base.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
isClosed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user