This depends on the InputStream or Reader object you are using and the method you are using from that object. If you are using the readLine method of BufferedReader, it returns null on the next read after the last data is read off the stream. If you are using the read(byte[], int, int) of FileInputStream, it returns -1 when there is no more data to read.
Consult the API's for the Stream you are using to determine what it uses.
Hope this helps