massive rewrite of io library
[org.ibex.io.git] / src / org / ibex / io / UnReaderStream.java
diff --git a/src/org/ibex/io/UnReaderStream.java b/src/org/ibex/io/UnReaderStream.java
new file mode 100644 (file)
index 0000000..ae1777e
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2000-2007 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
+
+package org.ibex.io;
+
+import java.io.*;
+
+/** package-private helper */
+class UnReaderStream extends OutputStream {
+
+    private final ByteBufInputStream bbis;
+    public UnReaderStream(ByteBufInputStream bbis) {
+        this.bbis = bbis;
+    }
+
+    public void close() { }
+    public void write(int i) throws IOException { byte[] b = new byte[1]; b[0] = (byte)i; write(b, 0, 1); }
+    public void write(byte[] b) throws IOException { write(b, 0, b.length); }
+    public void write(byte[] b, int p, int l) {
+        bbis.pushback(b, p, l);
+    }
+}