home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / io / FileInputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.5 KB  |  73 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 var1) throws FileNotFoundException {
  8.       SecurityManager var2 = System.getSecurityManager();
  9.       if (var2 != null) {
  10.          var2.checkRead(var1);
  11.       }
  12.  
  13.       try {
  14.          this.field_0 = new FileDescriptor();
  15.          this.open(var1);
  16.       } catch (IOException var3) {
  17.          throw new FileNotFoundException(var1);
  18.       }
  19.    }
  20.  
  21.    public FileInputStream(File var1) throws FileNotFoundException {
  22.       this(var1.getPath());
  23.    }
  24.  
  25.    public FileInputStream(FileDescriptor var1) {
  26.       SecurityManager var2 = System.getSecurityManager();
  27.       if (var1 == null) {
  28.          throw new NullPointerException();
  29.       } else {
  30.          if (var2 != null) {
  31.             var2.checkRead(var1);
  32.          }
  33.  
  34.          this.field_0 = var1;
  35.       }
  36.    }
  37.  
  38.    private native void open(String var1) throws IOException;
  39.  
  40.    public native int read() throws IOException;
  41.  
  42.    private native int readBytes(byte[] var1, int var2, int var3) throws IOException;
  43.  
  44.    public int read(byte[] var1) throws IOException {
  45.       return this.readBytes(var1, 0, var1.length);
  46.    }
  47.  
  48.    public int read(byte[] var1, int var2, int var3) throws IOException {
  49.       return this.readBytes(var1, var2, var3);
  50.    }
  51.  
  52.    public native long skip(long var1) throws IOException;
  53.  
  54.    public native int available() throws IOException;
  55.  
  56.    public native void close() throws IOException;
  57.  
  58.    public final FileDescriptor getFD() throws IOException {
  59.       if (this.field_0 != null) {
  60.          return this.field_0;
  61.       } else {
  62.          throw new IOException();
  63.       }
  64.    }
  65.  
  66.    protected void finalize() throws IOException {
  67.       if (this.field_0 != null && this.field_0 != FileDescriptor.in) {
  68.          this.close();
  69.       }
  70.  
  71.    }
  72. }
  73.