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 TypeMethodDescriptionintvoidclose()longlongintlongbooleanbooleanbooleanintread()intread(byte[] b, int off, int len) longskip(long len) longtransferTo(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:
nextChunkin 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:
isChunksDonein interfaceChunkInputStreamInterface- Returns:
- True if all chunks are done
-
getAvailableChunkSize
public long getAvailableChunkSize()- Specified by:
getAvailableChunkSizein interfaceChunkInputStreamInterface- Returns:
- if known, the chunk size currently available, else -1
-
getChunkSize
public long getChunkSize()- Specified by:
getChunkSizein interfaceChunkInputStreamInterface- Returns:
- the current buffer size
-
getCurrentPos
public int getCurrentPos()- Specified by:
getCurrentPosin interfaceChunkInputStreamInterface- Returns:
- the current position in the buffer
-
getCurrentTotalRead
public long getCurrentTotalRead()- Specified by:
getCurrentTotalReadin interfaceChunkInputStreamInterface- Returns:
- the total number of read bytes
-
read
- Specified by:
readin interfaceChunkInputStreamInterface- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin interfaceChunkInputStreamInterface- Overrides:
readin classInputStream- Throws:
IOException
-
skip
- Specified by:
skipin interfaceChunkInputStreamInterface- Overrides:
skipin classInputStream- Throws:
IOException
-
available
- Specified by:
availablein interfaceChunkInputStreamInterface- Overrides:
availablein classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChunkInputStreamInterface- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Specified by:
markSupportedin interfaceChunkInputStreamInterface- Overrides:
markSupportedin classInputStream
-
transferTo
- Specified by:
transferToin interfaceChunkInputStreamInterface- Overrides:
transferToin classInputStream- Throws:
IOException
-