home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / java / io / FileOutputStream.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.7 KB  |  94 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 var1) throws IOException {
  8.       SecurityManager var2 = System.getSecurityManager();
  9.       if (var2 != null) {
  10.          var2.checkWrite(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 FileOutputStream(String var1, boolean var2) throws IOException {
  22.       SecurityManager var3 = System.getSecurityManager();
  23.       if (var3 != null) {
  24.          var3.checkWrite(var1);
  25.       }
  26.  
  27.       try {
  28.          this.field_0 = new FileDescriptor();
  29.          if (var2) {
  30.             this.openAppend(var1);
  31.          } else {
  32.             this.open(var1);
  33.          }
  34.       } catch (IOException var4) {
  35.          throw new FileNotFoundException(var1);
  36.       }
  37.    }
  38.  
  39.    public FileOutputStream(File var1) throws IOException {
  40.       this(var1.getPath());
  41.    }
  42.  
  43.    public FileOutputStream(FileDescriptor var1) {
  44.       SecurityManager var2 = System.getSecurityManager();
  45.       if (var1 == null) {
  46.          throw new NullPointerException();
  47.       } else {
  48.          if (var2 != null) {
  49.             var2.checkWrite(var1);
  50.          }
  51.  
  52.          this.field_0 = var1;
  53.       }
  54.    }
  55.  
  56.    private native void open(String var1) throws IOException;
  57.  
  58.    private native void openAppend(String var1) throws IOException;
  59.  
  60.    public native void write(int var1) throws IOException;
  61.  
  62.    private native void writeBytes(byte[] var1, int var2, int var3) throws IOException;
  63.  
  64.    public void write(byte[] var1) throws IOException {
  65.       this.writeBytes(var1, 0, var1.length);
  66.    }
  67.  
  68.    public void write(byte[] var1, int var2, int var3) throws IOException {
  69.       this.writeBytes(var1, var2, var3);
  70.    }
  71.  
  72.    public native void close() throws IOException;
  73.  
  74.    public final FileDescriptor getFD() throws IOException {
  75.       if (this.field_0 != null) {
  76.          return this.field_0;
  77.       } else {
  78.          throw new IOException();
  79.       }
  80.    }
  81.  
  82.    protected void finalize() throws IOException {
  83.       if (this.field_0 != null) {
  84.          if (this.field_0 == FileDescriptor.out || this.field_0 == FileDescriptor.err) {
  85.             ((OutputStream)this).flush();
  86.             return;
  87.          }
  88.  
  89.          this.close();
  90.       }
  91.  
  92.    }
  93. }
  94.