You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2010/04/26 15:08:12 UTC

svn commit: r938029 - /harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java

Author: hindessm
Date: Mon Apr 26 13:08:12 2010
New Revision: 938029

URL: http://svn.apache.org/viewvc?rev=938029&view=rev
Log:
Changing this instance of the three seek pattern to use one JNI call
to fstat.  That this seems to behave correctly but that the RI does
three seeks for this case.  I can't understand why it makes sense to
use three seeks for this and fstat for FileChannel.

Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java?rev=938029&r1=938028&r2=938029&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java (original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/java/io/RandomAccessFile.java Mon Apr 26 13:08:12 2010
@@ -263,13 +263,7 @@ public class RandomAccessFile implements
     public long length() throws IOException {
         openCheck();
         synchronized (repositionLock) {
-            long currentPosition = fileSystem.seek(fd.descriptor, 0L,
-                    IFileSystem.SEEK_CUR);
-            long endOfFilePosition = fileSystem.seek(fd.descriptor, 0L,
-                    IFileSystem.SEEK_END);
-            fileSystem.seek(fd.descriptor, currentPosition,
-                    IFileSystem.SEEK_SET);
-            return endOfFilePosition;
+            return fileSystem.size(fd.descriptor);
         }
     }