コード例 #1
0
 /**
  * Closes this input stream and releases any system resources associated with the stream.
  *
  * @exception IOException if an I/O error occurs.
  */
 public void close() throws IOException {
   if (in == null) return;
   try {
     if (master) sf.forceClose();
     else sf.close();
   } finally {
     sf = null;
     in = null;
     buf = null;
   }
 }
コード例 #2
0
 private void init(SharedFile sf, int size) throws IOException {
   this.sf = sf;
   this.in = sf.open();
   this.start = 0;
   this.datalen = in.length(); // XXX - file can't grow
   this.bufsize = size;
   buf = new byte[size];
 }
コード例 #3
0
 /** Used internally by the <code>newStream</code> method. */
 private SharedFileInputStream(SharedFile sf, long start, long len, int bufsize) {
   super(null);
   this.master = false;
   this.sf = sf;
   this.in = sf.open();
   this.start = start;
   this.bufpos = start;
   this.datalen = len;
   this.bufsize = bufsize;
   buf = new byte[bufsize];
 }