1 // Copyright (C) 2003 Adam Megacz <adam@xwt.org> all rights reserved. 2 // 3 // You may modify, copy, and redistribute this code under the terms of 4 // the GNU Library Public License version 2.1, with the exception of 5 // the portion of clause 6a after the semicolon (aka the "obnoxious 6 // relink clause") 7 8 package org.xwt.util; 9 import java.io.*; 10 11 /** a generic interface for things that "know" their length */ 12 public interface KnownLength { 13 14 public abstract int getLength(); 15 16 public static class KnownLengthInputStream extends FilterInputStream implements KnownLength { 17 int length; 18 public int getLength() { return length; } 19 public KnownLengthInputStream(java.io.InputStream parent, int length) { 20 super(parent); 21 this.length = length; 22 } 23 } 24 25 } 26