You need to read the API doc for the DataInputStream class's readLine method. There are comments there on the recommended classes and methods to use.
Go here
Java Platform SE 6
and find a link to...