Package org.duracloud.chunk.stream
Class ChunkInputStream
java.lang.Object
java.io.InputStream
org.duracloud.chunk.stream.ChunkInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class provides the ability to limit the number of bytes read from the
provided InputStream to maxChunkSize.
- Author:
- Andrew Woods Date: Feb 2, 2010
-
Constructor Summary
ConstructorsConstructorDescriptionChunkInputStream(String chunkId, InputStream inputStream, long chunkSize, boolean preserveMD5) -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
ChunkInputStream
public ChunkInputStream(String chunkId, InputStream inputStream, long chunkSize, boolean preserveMD5)
-
-
Method Details
-
read
This method reads up to chunkSize number of bytes from the stream. When either chunkSize bytes have been read, or the end of the stream is reached, -1 is return.- Specified by:
readin classInputStream- Returns:
- current byte or -1 if eof reached
- Throws:
IOException- on error
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
getMD5
-
numBytesRead
public long numBytesRead() -
getChunkId
-
getMimetype
-
getChunkSize
public long getChunkSize() -
md5Preserved
public boolean md5Preserved()
-