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,
  long endOfFilePosition = fileSystem.seek(fd.descriptor, 0L,
  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.

View raw message