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

  1. package java.io;
  2.  
  3. public class FileOutputStream extends OutputStream {
  4.    // $FF: renamed from: fd java.io.FileDescriptor
  5.    private FileDescriptor field_0;
  6.  
  7.    public FileOutputStream(String name) throws IOException {
  8.       SecurityManager security = System.getSecurityManager();
  9.       if (security != null) {
  10.          security.checkWrite(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 FileOutputStream(File file) throws IOException {
  22.       this(file.getPath());
  23.    }
  24.  
  25.    public FileOutputStream(FileDescriptor fdObj) {
  26.       SecurityManager security = System.getSecurityManager();
  27.       if (security != null) {
  28.          security.checkWrite(fdObj);
  29.       }
  30.  
  31.       this.field_0 = fdObj;
  32.    }
  33.  
  34.    private native void open(String var1) throws IOException;
  35.  
  36.    public native void write(int var1) throws IOException;
  37.  
  38.    private native void writeBytes(byte[] var1, int var2, int var3) throws IOException;
  39.  
  40.    public void write(byte[] b) throws IOException {
  41.       this.writeBytes(b, 0, b.length);
  42.    }
  43.  
  44.    public void write(byte[] b, int off, int len) throws IOException {
  45.       this.writeBytes(b, off, len);
  46.    }
  47.  
  48.    public native void close() throws IOException;
  49.  
  50.    public final FileDescriptor getFD() throws IOException {
  51.       if (this.field_0 != null) {
  52.          return this.field_0;
  53.       } else {
  54.          throw new IOException();
  55.       }
  56.    }
  57.  
  58.    protected void finalize() throws IOException {
  59.       if (this.field_0 != null) {
  60.          this.close();
  61.       }
  62.  
  63.    }
  64. }
  65.