licensing update to APSL 2.0
[org.ibex.util.git] / src / org / ibex / util / KnownLength.java
1 // Copyright 2000-2005 the Contributors, as shown in the revision logs.
2 // Licensed under the Apache Public Source License 2.0 ("the License").
3 // You may not use this file except in compliance with the License.
4
5 package org.ibex.util;
6 import java.io.*;
7
8 /** a generic interface for things that "know" their length */
9 public interface KnownLength {
10
11     public abstract int getLength();
12
13     public static class KnownLengthInputStream extends FilterInputStream implements KnownLength {
14         int length;
15         public int getLength() { return length; }
16         public KnownLengthInputStream(java.io.InputStream parent, int length) {
17             super(parent);
18             this.length = length;
19         }
20     }
21
22 }