Why is there a check to see if Java is -1, why not a multiple like -10, or -33? Secondly, I believe this is to check if the data read is out of bounds (it should get to -1 at the end of the buffer read if I recall).
I have seen an explanation before, I am unable to find it at the moment. Any hints are appreciated.
Source:
http://tutorials.jenkov.com/java-exception-handling/try-with-resources.html