⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monitoredoutputstream.java

📁 一个视频网站的源码
💻 JAVA
字号:
package com.puckasoft.video312.upload;

import java.io.OutputStream;
import java.io.IOException;

public class MonitoredOutputStream extends OutputStream
{
  private OutputStream outputStream;
  private OutputStreamListener outputStreamListener;

  public MonitoredOutputStream(OutputStream outputStream, OutputStreamListener outputStreamListener)
  {
    this.outputStream = outputStream;
    this.outputStreamListener = outputStreamListener;
    this.outputStreamListener.start();
  }

  public void write(byte b[], int off, int len) throws IOException
  {
    outputStream.write(b,off,len);
    outputStreamListener.bytesRead(len - off);
  }

  public void write(byte b[]) throws IOException
  {
    outputStream.write(b);
    outputStreamListener.bytesRead(b.length);
  }

  public void write(int b) throws IOException
  {
    outputStream.write(b);
    outputStreamListener.bytesRead(1);
  }

  public void close() throws IOException
  {
    outputStream.close();
    outputStreamListener.done();
  }

  public void flush() throws IOException
  {
    outputStream.flush();
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -