java.io.FileInputStream.available()

Mattias Pantzare pantzer at ludd.luth.se
Fri Aug 1 10:19:42 PDT 1997


> Reason for posting:
> I have a query about the implementation of
>         java.io.FileInputStream.available()
> which according to the 1.1 API
> "Returns the number of bytes that can be read from this file input stream
> without blocking. "
> 
> On a freshly opened file with 500 bytes I always get 0.  File.length()
> returns the correct result (and so I have a workaround).

A freshly opened file can't be read from without blocking, a read from a
disk is usualy needed, so the read has to block. If you need the length
of the file, use .length().





More information about the kaffe mailing list