Revision: 2925
http://jnode.svn.sourceforge.net/jnode/?rev=2925&view=rev
Author: hagar-wize
Date: 2006-12-14 04:57:50 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
Classpath patches
Modified Paths:
--------------
trunk/core/src/classpath/java/java/io/FileOutputStream.java
trunk/core/src/classpath/java/java/io/RandomAccessFile.java
Modified: trunk/core/src/classpath/java/java/io/FileOutputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FileOutputStream.java 2006-12-14 12:57:01 UTC (rev 2924)
+++ trunk/core/src/classpath/java/java/io/FileOutputStream.java 2006-12-14 12:57:50 UTC (rev 2925)
@@ -38,8 +38,9 @@
package java.io;
-import gnu.java.nio.channels.FileChannelImpl;
+import gnu.java.nio.FileChannelImpl;
+import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -155,11 +156,24 @@
if (s != null)
s.checkWrite(file.getPath());
+ try
+ {
ch = FileChannelImpl.create(file, (append
? FileChannelImpl.WRITE
| FileChannelImpl.APPEND
: FileChannelImpl.WRITE));
}
+ catch (FileNotFoundException fnfe)
+ {
+ throw fnfe;
+ }
+ catch (IOException ioe)
+ {
+ FileNotFoundException fnfe = new FileNotFoundException(file.getPath());
+ fnfe.initCause(ioe);
+ throw fnfe;
+ }
+ }
/**
* This method initializes a <code>FileOutputStream</code> object to write
@@ -266,7 +280,7 @@
|| offset + len > buf.length)
throw new ArrayIndexOutOfBoundsException ();
- ch.write (buf, offset, len);
+ ch.write(ByteBuffer.wrap(buf, offset, len));
}
/**
Modified: trunk/core/src/classpath/java/java/io/RandomAccessFile.java
===================================================================
--- trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2006-12-14 12:57:01 UTC (rev 2924)
+++ trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2006-12-14 12:57:50 UTC (rev 2925)
@@ -38,7 +38,7 @@
package java.io;
-import gnu.java.nio.channels.FileChannelImpl;
+import gnu.java.nio.FileChannelImpl;
import java.nio.channels.FileChannel;
@@ -122,7 +122,20 @@
s.checkWrite(fileName);
}
+ try
+ {
ch = FileChannelImpl.create(file, fdmode);
+ }
+ catch (FileNotFoundException fnfe)
+ {
+ throw fnfe;
+ }
+ catch (IOException ioe)
+ {
+ FileNotFoundException fnfe = new FileNotFoundException(file.getPath());
+ fnfe.initCause(ioe);
+ throw fnfe;
+ }
fd = new FileDescriptor(ch);
if ((fdmode & FileChannelImpl.WRITE) != 0)
out = new DataOutputStream (new FileOutputStream (fd));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|