irix porting problem
jmc@cmpharm.ucsf.edu
jmc@cmpharm.ucsf.edu
Thu Jul 1 17:57:00 GMT 1999
So, does a FileInputStream always return the full length of a
file as available()? This is my experience on irix, linux, and
os/2 JVMs. According to the JDK 1.2 docs, this is not necessarily
the case, since the call "Returns the number of bytes that can be
read from this file input stream without blocking." If the standard
behavior is to return the full length (minus the number of bytes
already read), we should follow that. If the number can't be
determined for some reason, it's better to return 1 if we can
read anything without blocking (the same way InflaterInputStream does),
so it doesn't look like we're at the end of the file.
I'm not clear on whether the lseek() method of seeking to the end of
the file and back can itself cause blocking. For systems where FIONREAD
fails on files, lseek'ing to the end would only have to be done once,
when the file was opened, so it wouldn't be too expensive to use
this method every time available() is called.
JMC
--
John-Marc Chandonia (jmc@cmpharm.ucsf.edu) We're everywhere...
Cohen Lab, University of California San Francisco for your convenience.
http://yuri.harvard.edu/~jmc -- Psi Corps <*>
More information about the Java
mailing list