fix "limit" and "skip" logic in io (still not very good, though)
[org.ibex.io.git] / src / org / ibex / io / Stream.java
index 2cc2e14..70c90f8 100644 (file)
@@ -43,6 +43,7 @@ public class Stream {
 
     // Main API //////////////////////////////////////////////////////////////////////////////
 
+    public void   setLimit(int limit)              { in.setLimit(limit); }
     public char   peekc()                          { flush(); return in.getc(true); }
     public char   getc()                           { flush(); return in.getc(false); }
     public String readln()                         { flush(); return in.readln(); }
@@ -52,6 +53,7 @@ public class Stream {
     public void writeBytes(byte[] b, int off, int len) { try { out.write(b, off, len); } catch (IOException e) { ioe(e); } }
     public int    read(byte[] b, int off, int len) { flush(); return in.readBytes(b, off, len); }
     public int    read(char[] c, int off, int len) { flush(); return in.readChars(c, off, len); }
+    public int    skip(int len) { return in.skip(len); }
     public void   close()                          { try { if (in!=null) in.close(); } finally { if (out!=null) out.close(); } }
     public void   setNewline(String s)             { newLine = s; }
     public InputStream getInputStream() { return in; }
@@ -85,12 +87,14 @@ public class Stream {
 
         public char getc(boolean peek) { return cbr.getc(peek); }
         public String readln() { return cbr.readln(); }
+        public int skip(int len) { return bbis.skip(len); }
         public int read() { return bbis.read(); }
         public int read(byte[] b) { try { return bbis.read(b); } catch (IOException e) { ioe(e); return 0; } }
         public int read(byte[] b, int off, int len) { return bbis.read(b, off, len); }
         public void close() { try { cbr.close(); } catch (Exception e) { Log.error(this, e); } }
         public int readBytes(byte[] b, int off, int len) { return bbis.read(b, off, len); }
         public int readChars(char[] c, int off, int len) { return cbr.read(c, off, len); }
+        public void setLimit(int len) { bbis.setLimit(len); }
 
         public In(InputStream in) {
             bbis = new ByteBufInputStream(in) {