org.apache.xmlgraphics.util.io
Class SubInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.xmlgraphics.util.io.SubInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class SubInputStream
- extends java.io.FilterInputStream
This class is a FilterInputStream descendant that reads from an underlying InputStream
up to a defined number of bytes or the end of the underlying stream. Closing this InputStream
will not result in the underlying InputStream to be closed, too.
This InputStream can be used to read chunks from a larger file of which the length is
known in advance.
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary |
SubInputStream(java.io.InputStream in,
long maxLen)
Creates a new SubInputStream. |
Method Summary |
void |
close()
|
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
long |
skip(long n)
|
Methods inherited from class java.io.FilterInputStream |
available, mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SubInputStream
public SubInputStream(java.io.InputStream in,
long maxLen)
- Creates a new SubInputStream.
- Parameters:
in
- the InputStream to read frommaxLen
- the maximum number of bytes to read from the underlying InputStream until
the end-of-file is signalled.
read
public int read()
throws java.io.IOException
- Overrides:
read
in class java.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read()
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
- See Also:
InputStream.read(byte[], int, int)
skip
public long skip(long n)
throws java.io.IOException
- Overrides:
skip
in class java.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.skip(long)
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.close()
Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.