com.dyuproject.protostuff
Class LimitedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.dyuproject.protostuff.LimitedInputStream
All Implemented Interfaces:
java.io.Closeable

public final class LimitedInputStream
extends java.io.FilterInputStream

An InputStream implementations which reads from some other InputStream but is limited to a particular number of bytes.

Author:
David Yu
Date created:
Jan 14, 2010

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LimitedInputStream(java.io.InputStream in)
           
LimitedInputStream(java.io.InputStream in, int 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)

LimitedInputStream

public LimitedInputStream(java.io.InputStream in,
                          int limit)
Method Detail

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

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

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException


Copyright © 2009-2014. All Rights Reserved.