Since InputStream.available() cannot be relied on and block reading [ read(byte) ] seems to be error prone - the only way: byte by byte reading the whole stream just to count the number of bytes read to get the size of a file -it, at least to say, takes time, valuable in some situations. Did I miss some way of jar file's size aquiring method, bypassing the mentioned routines?
You seem to have answered most of your own questions. There is no way (other than available() which isn't very reliable) to know how big the file is. If knowing this is crucial then you could always add this data as a header of sorts to your files (ie, the first 4 bytes of a file represent an int that is the file size).