home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / java / io / FileInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-10-20  |  1.8 KB  |  69 lines

  1. package java.io;
  2.  
  3. public class FileInputStream extends InputStream {
  4.    // $FF: renamed from: fd java.io.FileDescriptor
  5.    private FileDescriptor field_0;
  6.  
  7.    public FileInputStream(String name) throws FileNotFoundException {
  8.       SecurityManager security = System.getSecurityManager();
  9.       if (security != null) {
  10.          security.checkRead(name);
  11.       }
  12.  
  13.       try {
  14.          this.field_0 = new FileDescriptor();
  15.          this.open(name);
  16.       } catch (IOException var3) {
  17.          throw new FileNotFoundException(name);
  18.       }
  19.    }
  20.  
  21.    public FileInputStream(File file) throws FileNotFoundException {
  22.       this(file.getPath());
  23.    }
  24.  
  25.    public FileInputStream(FileDescriptor fdObj) {
  26.       SecurityManager security = System.getSecurityManager();
  27.       if (security != null) {
  28.          security.checkRead(fdObj);
  29.       }
  30.  
  31.       this.field_0 = fdObj;
  32.    }
  33.  
  34.    private native void open(String var1) throws IOException;
  35.  
  36.    public native int read() throws IOException;
  37.  
  38.    private native int readBytes(byte[] var1, int var2, int var3) throws IOException;
  39.  
  40.    public int read(byte[] b) throws IOException {
  41.       return this.readBytes(b, 0, b.length);
  42.    }
  43.  
  44.    public int read(byte[] b, int off, int len) throws IOException {
  45.       return this.readBytes(b, off, len);
  46.    }
  47.  
  48.    public native long skip(long var1) throws IOException;
  49.  
  50.    public native int available() throws IOException;
  51.  
  52.    public native void close() throws IOException;
  53.  
  54.    public final FileDescriptor getFD() throws IOException {
  55.       if (this.field_0 != null) {
  56.          return this.field_0;
  57.       } else {
  58.          throw new IOException();
  59.       }
  60.    }
  61.  
  62.    protected void finalize() throws IOException {
  63.       if (this.field_0 != null) {
  64.          this.close();
  65.       }
  66.  
  67.    }
  68. }
  69.