+ public static boolean loggingEnabled = "true".equals(System.getProperty("ibex.io.stream.logEnabled", "false"));
+
+ public void transcribe(Stream out) {
+ try {
+ byte[] buf = new byte[1024];
+ while(true) {
+ int numread = in.read(buf, 0, buf.length);
+ if (numread==-1) return;
+ out.out.write(buf, 0, numread);
+ }
+ } catch (IOException ioe) { throw new StreamException(ioe); }
+ }
+
+ public void transcribe(StringBuffer out) {
+ //try {
+ char[] buf = new char[1024];
+ while(true) {
+ int numread = in.read(buf, 0, buf.length);
+ if (numread==-1) return;
+ out.append(buf, 0, numread);
+ }
+ //} catch (IOException ioe) { throw new StreamException(ioe); }
+ }
+
+ public static int countLines(Stream s) {
+ int ret = 0;
+ while(s.readln() != null) ret++;
+ return ret;
+ }
+
+ public Stream(byte[] b, int off, int len) { this.in = new Stream.In(new ByteArrayInputStream(b, off, len)); this.out=null; }