Open liu-xinhui opened 4 years ago
The FileInputStream
that is returned is always indeed returning 0
for available. As you can read in the JavaDoc for InputStream:
Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected.
So 0
can mean either End-of-Stream has been reached, or there are 0
bytes available without issuing a blocking call. The latter is true.
If you want to easily copy the contents to an OutputStream
use the File.read(OutputStream)
call instead.
An option would be to do a call on available()
to pre-fill the buffer, that would prevent this from happening.
share.fileExists(filename) is true ,but is.available() always 0, file is 0kb when browser download