Class ChunkInputStreamNotBuffered
java.lang.Object
java.io.InputStream
io.clonecloudstore.common.quarkus.stream.ChunkInputStreamNotBuffered
- All Implemented Interfaces:
ChunkInputStreamInterface
,Closeable
,AutoCloseable
Transform one InputStream to Multiple InputStream, each one being a chunk of the primary one.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChunkInputStreamNotBuffered
(InputStream inputStream, long len, int chunkSize) -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
long
long
int
long
boolean
boolean
boolean
int
read()
int
read
(byte[] b, int off, int len) long
skip
(long len) long
transferTo
(OutputStream out) Methods inherited from class java.io.InputStream
mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes
-
Field Details
-
MIN_CHUNK_SIZE
public static final int MIN_CHUNK_SIZE- See Also:
-
maxChunkSize
public final int maxChunkSize
-
-
Constructor Details
-
ChunkInputStreamNotBuffered
- Parameters:
inputStream
- the InputStream to split as multiple InputStream by chunklen
- the real InputStream size if knownchunkSize
- the chunk size to split on
-
-
Method Details
-
nextChunk
- Specified by:
nextChunk
in interfaceChunkInputStreamInterface
- Returns:
- True if the next Chunk of InputStream is ready, possibly empty, else implies closing of native InputStream
- Throws:
IOException
- if an issue occurs
-
isChunksDone
public boolean isChunksDone()- Specified by:
isChunksDone
in interfaceChunkInputStreamInterface
- Returns:
- True if all chunks are done
-
getAvailableChunkSize
public long getAvailableChunkSize()- Specified by:
getAvailableChunkSize
in interfaceChunkInputStreamInterface
- Returns:
- if known, the chunk size currently available, else -1
-
getChunkSize
public long getChunkSize()- Specified by:
getChunkSize
in interfaceChunkInputStreamInterface
- Returns:
- the current buffer size
-
getCurrentPos
public int getCurrentPos()- Specified by:
getCurrentPos
in interfaceChunkInputStreamInterface
- Returns:
- the current position in the buffer
-
getCurrentTotalRead
public long getCurrentTotalRead()- Specified by:
getCurrentTotalRead
in interfaceChunkInputStreamInterface
- Returns:
- the total number of read bytes
-
read
- Specified by:
read
in interfaceChunkInputStreamInterface
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Specified by:
read
in interfaceChunkInputStreamInterface
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Specified by:
skip
in interfaceChunkInputStreamInterface
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
available
- Specified by:
available
in interfaceChunkInputStreamInterface
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChunkInputStreamInterface
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Specified by:
markSupported
in interfaceChunkInputStreamInterface
- Overrides:
markSupported
in classInputStream
-
transferTo
- Specified by:
transferTo
in interfaceChunkInputStreamInterface
- Overrides:
transferTo
in classInputStream
- Throws:
IOException
-