mass rename and rebranding from xwt to ibex - fixed to use ixt files
[org.ibex.core.git] / src / org / ibex / util / KnownLength.java
diff --git a/src/org/ibex/util/KnownLength.java b/src/org/ibex/util/KnownLength.java
new file mode 100644 (file)
index 0000000..06118bb
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (C) 2003 Adam Megacz <adam@ibex.org> all rights reserved.
+//
+// You may modify, copy, and redistribute this code under the terms of
+// the GNU Library Public License version 2.1, with the exception of
+// the portion of clause 6a after the semicolon (aka the "obnoxious
+// relink clause")
+
+package org.ibex.util;
+import java.io.*;
+
+/** a generic interface for things that "know" their length */
+public interface KnownLength {
+
+    public abstract int getLength();
+
+    public static class KnownLengthInputStream extends FilterInputStream implements KnownLength {
+        int length;
+        public int getLength() { return length; }
+        public KnownLengthInputStream(java.io.InputStream parent, int length) {
+            super(parent);
+            this.length = length;
+        }
+    }
+
+}