Class CountingInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.elasticsearch.xpack.esql.datasources.cache.CountingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
Wraps an
InputStream and counts the bytes successfully read. Used by the line-oriented
text-format readers to publish a sizeInBytes statistic for stream-only sources (bzip2,
zstd-streamed) whose StorageObject.length()
throws UnsupportedOperationException.
The count reflects bytes consumed from the underlying stream, including bytes pulled into a
downstream buffer (e.g. BufferedReader's 8 KiB block) regardless of whether the reader
subsequently propagates them. For a clean whole-file drain this equals the decompressed file
size; for partial drains (the cache gate refuses the write in that case) it is an over-estimate.
-
Field Summary
Fields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, markSupported, readMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
CountingInputStream
-
-
Method Details
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classFilterInputStream
-
reset
- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
getBytesRead
public long getBytesRead()
-