Package org.apache.hadoop.fs.statistics
Class BufferedIOStatisticsInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.BufferedInputStream
org.apache.hadoop.fs.statistics.BufferedIOStatisticsInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,IOStatisticsSource,StreamCapabilities
public class BufferedIOStatisticsInputStream
extends BufferedInputStream
implements IOStatisticsSource, StreamCapabilities
An extension of
BufferedInputStream which implements
IOStatisticsSource and forwards requests for the
IOStatistics to the wrapped stream.
This should be used when any input stream needs buffering while
allowing the inner stream to be a source of statistics.
It also implements StreamCapabilities and forwards the probe
to the inner stream, if possible.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.fs.StreamCapabilities
StreamCapabilities.StreamCapability -
Field Summary
Fields inherited from class java.io.FilterInputStream
inFields inherited from interface org.apache.hadoop.fs.StreamCapabilities
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO, VECTOREDIO_BUFFERS_SLICED -
Constructor Summary
ConstructorsConstructorDescriptionBuffer an input stream with the default buffer size of 8k.BufferedIOStatisticsInputStream(InputStream in, int size) Buffer an input stream with the chosen buffer size. -
Method Summary
Modifier and TypeMethodDescriptionReturn any IOStatistics offered by the inner stream.booleanhasCapability(String capability) If the inner stream supportsStreamCapabilities, forward the probe to it.Methods inherited from class java.io.BufferedInputStream
available, close, mark, markSupported, read, read, reset, skipMethods inherited from class java.io.FilterInputStream
readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
BufferedIOStatisticsInputStream
Buffer an input stream with the default buffer size of 8k.- Parameters:
in- input stream
-
BufferedIOStatisticsInputStream
Buffer an input stream with the chosen buffer size.- Parameters:
in- input streamsize- buffer size
-
-
Method Details
-
getIOStatistics
Return any IOStatistics offered by the inner stream.- Specified by:
getIOStatisticsin interfaceIOStatisticsSource- Returns:
- inner IOStatistics or null
-
hasCapability
If the inner stream supportsStreamCapabilities, forward the probe to it. Otherwise: return false.- Specified by:
hasCapabilityin interfaceStreamCapabilities- Parameters:
capability- string to query the stream support for.- Returns:
- true if a capability is known to be supported.
-