java - InputStreamReader's read() method doesn't return anything -
i'm java , android developer. work software update application , use ftp4j project ftp library have problem. when connection's speed low @ end of download while getting ftp reply there strange issue. in codes @ bottom "int = reader.read()" doesn't return codes doesnt continue run. checked whether reader ready or not returns true when issue occurs. how can fix issue? helpless now. here codes:
public string readline() throws ioexception { stringbuffer buffer = new stringbuffer(); int previous = -1; int current = -1; { int = reader.read(); if (i == -1) { if (buffer.length() == 0) { return null; } else { return buffer.tostring(); } } previous = current; current = i; if (/* previous == '\r' && */current == '\n') { // end of line. return buffer.tostring(); } else if (previous == '\r' && current == 0) { // literal new line. buffer.append(system_line_separator); } else if (current != 0 && current != '\r') { buffer.append((char) current); } } while (true); }
p.s : reader inputstreamreader.
Comments
Post a Comment