I uploaded a JAR file that was 21 KB in size on my computer to a website. I found the direct link to that JAR file and I create an InputStream to that file:
URL url = new URL("addresstofile");
InputStream stream = url.openStream();
It would be expected that the amount of bytes available in the stream would be ~21,000. However, the amount available is 7,048. In an attempt to debug, I saved those 7,048 bytes in a byte array and then I write those bytes to a temporary file with the extension ".jar"
I extract the classes in the JAR file (that is 7 KB; the original is 21 KB). Most of the classes are there except I noticed that nested classes are not present. I am not sure as to why that is - is it just a coincidence that the InputStream just cuts out there, or are there some special exceptions to nested classes?
Why is InputStream acting so oddly? Thanks!
@Neil: This works! Thanks a lot!
read()returns -1. Ignore theavailable()method. It's really not useful for much.