public final class FixedLengthInputStream extends java.io.FilterInputStream
InputStream with a fixed amount of bytes available to read.
When the stream is closed the remaining bytes that have not been read are
read or skipped.| Modifier and Type | Field and Description |
|---|---|
protected long |
remaining
Remaining bytes available.
|
| Constructor and Description |
|---|
FixedLengthInputStream(java.io.InputStream in,
long length)
Create a new input stream with a fixed number of bytes available from
the underlying stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close()
Closing will only skip to the end of this fixed length input stream and
not call the parent's close method.
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
protected long remaining
public FixedLengthInputStream(java.io.InputStream in, long length)
in - the input stream to wraplength - fixed number of bytes available through this streampublic void close() throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOException - if an I/O error occurs while closing streampublic int available() throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.FilterInputStreampublic void mark(int readlimit)
mark in class java.io.FilterInputStreampublic void reset() throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read() throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b) throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] b, int off, int len) throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic long skip(long n) throws java.io.IOException
skip in class java.io.FilterInputStreamjava.io.IOExceptionCopyright © 2011–2023. All rights reserved.