[java] Catch end of file on stdin
Merge pull request #2155 from jonasmalacofilho/development

[java] Catch end of file on stdin