Class SlicedInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.elasticsearch.index.snapshots.blobstore.SlicedInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public abstract class SlicedInputStream extends InputStream
ASlicedInputStreamis a logical concatenation one or more input streams. In contrast to the JDKsSequenceInputStreamthis stream doesn't require the instantiation of all logical sub-streams ahead of time. Instead,openSlice(long)is called if a new slice is required. Each slice is closed once it's been fully consumed or if close is called before.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSlicedInputStream(long numSlices)Creates a new SlicedInputStream
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()protected abstract InputStreamopenSlice(long slice)Called for each logical slice given a zero based slice ordinal.intread()intread(byte[] buffer, int offset, int length)-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Method Detail
-
openSlice
protected abstract InputStream openSlice(long slice) throws IOException
Called for each logical slice given a zero based slice ordinal.- Throws:
IOException
-
read
public final int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public final int read(byte[] buffer, int offset, int length) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
close
public final void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
available
public final int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
-