home *** CD-ROM | disk | FTP | other *** search
/ Australian PC Authority 1999 May / may1999.iso / INTERNET / COMMUNIC / NETCAST.Z / marimb10.jar / netscape / netcast / FileCacheOutputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-25  |  1.4 KB  |  34 lines

  1. package netscape.netcast;
  2.  
  3. import java.io.IOException;
  4. import java.io.RandomAccessFile;
  5. import marimba.io.RAFOutputStream;
  6.  
  7. final class FileCacheOutputStream extends RAFOutputStream {
  8.    FileCacheFile file;
  9.  
  10.    FileCacheOutputStream(FileCacheFile file) throws IOException {
  11.       super(new RandomAccessFile(file, "rw"));
  12.       this.file = file;
  13.    }
  14.  
  15.    public void write(int b) throws IOException {
  16.       super.write(b);
  17.       this.file.cache.notifyData(this.file.getChecksum());
  18.    }
  19.  
  20.    public void write(byte[] b) throws IOException {
  21.       this.write(b, 0, b.length);
  22.    }
  23.  
  24.    public void write(byte[] b, int off, int len) throws IOException {
  25.       super.write(b, off, len);
  26.       this.file.cache.notifyData(this.file.getChecksum());
  27.    }
  28.  
  29.    public void close() throws IOException {
  30.       super.close();
  31.       this.file.cache.notifyComplete(this.file.getChecksum());
  32.    }
  33. }
  34.