home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- import java.nio.channels.FileChannel;
- import sun.nio.ch.FileChannelImpl;
-
- public class FileOutputStream extends OutputStream {
- // $FF: renamed from: fd java.io.FileDescriptor
- private FileDescriptor field_0;
- private FileChannel channel;
- private boolean append;
-
- public FileOutputStream(String var1) throws FileNotFoundException {
- this(var1 != null ? new File(var1) : null, false);
- }
-
- public FileOutputStream(String var1, boolean var2) throws FileNotFoundException {
- this(var1 != null ? new File(var1) : null, var2);
- }
-
- public FileOutputStream(File var1) throws FileNotFoundException {
- this(var1, false);
- }
-
- public FileOutputStream(File var1, boolean var2) throws FileNotFoundException {
- this.channel = null;
- this.append = false;
- String var3 = var1 != null ? var1.getPath() : null;
- SecurityManager var4 = System.getSecurityManager();
- if (var4 != null) {
- var4.checkWrite(var3);
- }
-
- if (var3 == null) {
- throw new NullPointerException();
- } else {
- this.field_0 = new FileDescriptor();
- this.append = var2;
- if (var2) {
- this.openAppend(var3);
- } else {
- this.open(var3);
- }
-
- }
- }
-
- public FileOutputStream(FileDescriptor var1) {
- this.channel = null;
- this.append = false;
- SecurityManager var2 = System.getSecurityManager();
- if (var1 == null) {
- throw new NullPointerException();
- } else {
- if (var2 != null) {
- var2.checkWrite(var1);
- }
-
- this.field_0 = var1;
- }
- }
-
- private native void open(String var1) throws FileNotFoundException;
-
- private native void openAppend(String var1) throws FileNotFoundException;
-
- public native void write(int var1) throws IOException;
-
- private native void writeBytes(byte[] var1, int var2, int var3) throws IOException;
-
- public void write(byte[] var1) throws IOException {
- this.writeBytes(var1, 0, var1.length);
- }
-
- public void write(byte[] var1, int var2, int var3) throws IOException {
- this.writeBytes(var1, var2, var3);
- }
-
- public void close() throws IOException {
- if (this.channel != null) {
- this.channel.close();
- }
-
- this.close0();
- }
-
- public final FileDescriptor getFD() throws IOException {
- if (this.field_0 != null) {
- return this.field_0;
- } else {
- throw new IOException();
- }
- }
-
- public FileChannel getChannel() {
- synchronized(this) {
- if (this.channel == null) {
- this.channel = FileChannelImpl.open(this.field_0, false, true, this, this.append);
- }
-
- return this.channel;
- }
- }
-
- protected void finalize() throws IOException {
- if (this.field_0 != null) {
- FileDescriptor var10001 = this.field_0;
- if (this.field_0 != FileDescriptor.out) {
- var10001 = this.field_0;
- if (this.field_0 != FileDescriptor.err) {
- this.close();
- return;
- }
- }
-
- this.flush();
- }
-
- }
-
- private native void close0() throws IOException;
-
- private static native void initIDs();
-
- static {
- initIDs();
- }
- }
-