public final class FixedLengthInputStream extends 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.in
Constructor and Description |
---|
FixedLengthInputStream(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) |
public FixedLengthInputStream(InputStream in, long length)
in
- the input stream to wraplength
- fixed number of bytes available through this streampublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
- if an I/O error occurs while closing streampublic int available()
available
in class FilterInputStream
public boolean markSupported()
markSupported
in class FilterInputStream
public void mark(int readlimit)
mark
in class FilterInputStream
public void reset()
reset
in class FilterInputStream
public int read() throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b) throws IOException
read
in class FilterInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
IOException
public long skip(long n) throws IOException
skip
in class FilterInputStream
IOException
Copyright © 2000–2024 Packwood Software. All rights reserved.