X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fio%2FStream.java;h=0d6c169915cbccbe886c1f792325d10e7958d07e;hb=3b2ea827949a6b21b360f43dc829e34650d9c203;hp=558e0ca5f552e61d3f9584d868c159f81b44f075;hpb=5d5ae8848f8c54d02af45f153e7712cb6d1edf05;p=org.ibex.io.git diff --git a/src/org/ibex/io/Stream.java b/src/org/ibex/io/Stream.java index 558e0ca..0d6c169 100644 --- a/src/org/ibex/io/Stream.java +++ b/src/org/ibex/io/Stream.java @@ -27,14 +27,16 @@ public class Stream { public static boolean loggingEnabled = "true".equals(System.getProperty("ibex.io.stream.logEnabled", "false")); - public void transcribe(Stream out) { + public void transcribe(Stream out) { transcribe(out, false); } + public void transcribe(Stream out, boolean close) { try { byte[] buf = new byte[1024]; while(true) { int numread = in.read(buf, 0, buf.length); - if (numread==-1) return; + if (numread==-1) break; out.out.write(buf, 0, numread); } + if (close) out.close(); } catch (IOException ioe) { throw new StreamException(ioe); } }