public String readLine() throws IOException { List<Byte> byteList = new ArrayList<Byte>(); int ch;
while ((ch = inputStream.read()) != -1) { if (ch == R_CHAR) {
ch = inputStream.read();
if (ch == N_CHAR) {
break;
} else {
byteList.add((byte) R_CHAR);
byteList.add((byte) ch);
}
} else {
byteList.add((byte) ch);
}
} byte[] byteArray = new byte[byteList.size()];
for (int i = 0; i < byteArray.length; i++) {
byteArray[i] = byteList.get(i);
} return new String(byteArray, "UTF-8");
}