📄 monitoredoutputstream.java
字号:
package book.upload;
import java.io.IOException;
import java.io.OutputStream;
public class MonitoredOutputStream extends OutputStream {
private OutputStream target;
private OutputStreamListener listener;
public MonitoredOutputStream(OutputStream target,
OutputStreamListener listener) {
this.target = target;
this.listener = listener;
}
public void write(byte b[], int off, int len) throws IOException {
target.write(b, off, len);
listener.bytesRead(len - off);
}
public void write(byte b[]) throws IOException {
target.write(b);
listener.bytesRead(b.length);
}
public void write(int b) throws IOException {
target.write(b);
listener.bytesRead(1);
}
public void close() throws IOException {
target.close();
}
public void flush() throws IOException {
target.flush();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -