import java.net.*;
import java.util.zip.*;
import org.ibex.util.*;
-import org.ibex.net.*;
/** plays the role of InputStream, OutputStream, Reader and Writer, with logging and unchecked exceptions */
public class Stream {
public void unread(String s) { in.unread(s); }
public void println() { println(""); }
- public void println(String s) { logWrite(s); out.write(s); out.write(newLine); }
+ public void print(String s) { logWrite(s); out.write(s); flush(); }
+ public void println(String s) { logWrite(s); out.write(s); out.write(newLine); flush(); }
public void flush() { if (out != null) try { out.w.flush(); } catch(IOException e) { ioe(e); } }
- public void close() { in.close(); out.close(); }
+ public void close() { try { in.close(); } finally { out.close(); } }
public void setNewline(String s) { newLine = s; }
int len = i-cstart;
cstart = i+1;
if (cbuf[begin] == '\r') { begin++; len--; }
- if (len > 0 && cbuf[begin+len-1] == '\r') { len--; }
+ while (len > 0 && cbuf[begin+len-1] == '\r') { len--; }
return new String(cbuf, begin, len);
}
ensurec(256);