Java Utililty Methods DataInputStream Read Line

List of utility methods to do DataInputStream Read Line

Description

The list of methods to do DataInputStream Read Line are organized into topic(s).

Method

StringreadLine(DataInputStream dis)
Service routine
String s = "";
byte ch = 0;
try {
    while ((ch = dis.readByte()) != -1) {
        if (ch == '\n')
            return s;
        s += (char) ch;
} catch (Exception e) {
    e.printStackTrace();
return s;
StringreadLine(DataInputStream ds)
read a line from InputStreamReader, it will block until a '\n' is read.
StringBuffer sb = new StringBuffer();
int c = ds.readByte();
while (c != '\n' && c != -1) {
    sb.append((char) c);
    c = ds.readByte();
return sb.toString();
StringreadLine(DataInputStream in)
read Line
String s = "";
while (true) {
    int b = in.read();
    if (b == '\n')
        return s;
    else
        s += (char) b;