SK.gnome.dwarf.utils.io
Class LimitedInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended bySK.gnome.dwarf.utils.io.LimitedInputStream

public class LimitedInputStream
extends java.io.FilterInputStream

Provides limited-length input stream.

This stream filteres the source input stream and provides up to the maximum length of the source octets.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LimitedInputStream(java.io.InputStream in, int limit)
          Creates a new LimitedInputStream with the given length limit.
 
Method Summary
 int available()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 long skip(long n)
           
 
Methods inherited from class java.io.FilterInputStream
close, mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimitedInputStream

public LimitedInputStream(java.io.InputStream in,
                          int limit)
Creates a new LimitedInputStream with the given length limit.

Parameters:
in - the source stream
limit - the length limit
Throws:
java.lang.IllegalArgumentException - if the limit is negative
Method Detail

available

public int available()
              throws java.io.IOException
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Throws:
java.io.IOException


Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.