Package org.apache.commons.io.input
Class UnsynchronizedFilterInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.io.input.UnsynchronizedFilterInputStream
- All Implemented Interfaces:
- Closeable,- AutoCloseable
- Direct Known Subclasses:
- UnsynchronizedBufferedInputStream
An unsynchronized version of 
FilterInputStream, not thread-safe.
 
 Wraps an existing InputStream and performs some transformation on the input data while it is being read. Transformations can be anything from a
 simple byte-wise filtering input data to an on-the-fly compression or decompression of the underlying stream. Input streams that wrap another input stream
 and provide some additional functionality on top of it usually inherit from this class.
 
 To build an instance, use UnsynchronizedFilterInputStream.Builder.
 
Provenance: Apache Harmony and modified.
- Since:
- 2.12.0
- See Also:
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionintReturns the number of bytes that are available before this stream will block.builder()Constructs a newUnsynchronizedFilterInputStream.Builder.voidclose()Closes this stream.voidmark(int readLimit) Sets a mark position in this stream.booleanIndicates whether this stream supportsmark()andreset().intread()Reads a single byte from the filtered stream and returns it as an integer in the range from 0 to 255.intread(byte[] buffer) Reads bytes from this stream and stores them in the byte arraybuffer.intread(byte[] buffer, int offset, int count) Reads at mostcountbytes from this stream and stores them in the byte arraybufferstarting atoffset.voidreset()Resets this stream to the last marked location.longskip(long count) Skipscountnumber of bytes in this stream.
- 
Field Details- 
inputStreamThe source input stream that is filtered.
 
- 
- 
Method Details- 
builderConstructs a newUnsynchronizedFilterInputStream.Builder.- Returns:
- a new UnsynchronizedFilterInputStream.Builder.
 
- 
availableReturns the number of bytes that are available before this stream will block.- Overrides:
- availablein class- InputStream
- Returns:
- the number of bytes available before blocking.
- Throws:
- IOException- if an error occurs in this stream.
 
- 
closeCloses this stream. This implementation closes the filtered stream.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Overrides:
- closein class- InputStream
- Throws:
- IOException- if an error occurs while closing this stream.
 
- 
markSets a mark position in this stream. The parameterreadLimitindicates how many bytes can be read before the mark is invalidated. Sendingreset()will reposition this stream back to the marked position, provided thatreadLimithas not been surpassed.This implementation sets a mark in the filtered stream. - Overrides:
- markin class- InputStream
- Parameters:
- readLimit- the number of bytes that can be read from this stream before the mark is invalidated.
- See Also:
 
- 
markSupportedIndicates whether this stream supportsmark()andreset(). This implementation returns whether or not the filtered stream supports marking.- Overrides:
- markSupportedin class- InputStream
- Returns:
- trueif- mark()and- reset()are supported,- falseotherwise.
- See Also:
 
- 
readReads a single byte from the filtered stream and returns it as an integer in the range from 0 to 255. Returns -1 if the end of this stream has been reached.- Specified by:
- readin class- InputStream
- Returns:
- the byte read or -1 if the end of the filtered stream has been reached.
- Throws:
- IOException- if the stream is closed or another IOException occurs.
 
- 
readReads bytes from this stream and stores them in the byte arraybuffer. Returns the number of bytes actually read or -1 if no bytes were read and the end of this stream was encountered. This implementation reads bytes from the filtered stream.- Overrides:
- readin class- InputStream
- Parameters:
- buffer- the byte array in which to store the read bytes.
- Returns:
- the number of bytes actually read or -1 if the end of the filtered stream has been reached while reading.
- Throws:
- IOException- if this stream is closed or another IOException occurs.
 
- 
readReads at mostcountbytes from this stream and stores them in the byte arraybufferstarting atoffset. Returns the number of bytes actually read or -1 if no bytes have been read and the end of this stream has been reached. This implementation reads bytes from the filtered stream.- Overrides:
- readin class- InputStream
- Parameters:
- buffer- the byte array in which to store the bytes read.
- offset- the initial position in- bufferto store the bytes read from this stream.
- count- the maximum number of bytes to store in- buffer.
- Returns:
- the number of bytes actually read or -1 if the end of the filtered stream has been reached while reading.
- Throws:
- IOException- if this stream is closed or another I/O error occurs.
 
- 
resetResets this stream to the last marked location. This implementation resets the target stream.- Overrides:
- resetin class- InputStream
- Throws:
- IOException- if this stream is already closed, no mark has been set or the mark is no longer valid because more than- readLimitbytes have been read since setting the mark.
- See Also:
 
- 
skipSkipscountnumber of bytes in this stream. Subsequentread()'s will not return these bytes unlessreset()is used. This implementation skipscountnumber of bytes in the filtered stream.- Overrides:
- skipin class- InputStream
- Parameters:
- count- the number of bytes to skip.
- Returns:
- the number of bytes actually skipped.
- Throws:
- IOException- if this stream is closed or another IOException occurs.
- See Also:
 
 
-