harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Hindess" <mark.hind...@googlemail.com>
Subject [classlib] BufferedReader and FileInputStream.available()
Date Tue, 03 Nov 2009 21:29:58 GMT

Our implementation of BufferedReader calls FileInputStream.available()
while the RI does not.  This is a problem because it means that the RI
can read certain types of files that our implementation can not - such
as /proc/mounts on Linux.  I will investigate this shortly.

While looking at this I notice that our implementation of 
FileInputStream.available() does:

  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 (int) (endOfFilePosition - currentPosition);

making three JNI calls.  It might be better to implement this as a
single JNI call - particularly since at the moment we seem to be calling
it more often than the RI.

Comments welcome.
 Mark.



Mime
View raw message