Package org.dspace.storage.bitstore
Class S3BitStoreService.S3LazyInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.dspace.storage.bitstore.S3BitStoreService.S3LazyInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- S3BitStoreService
public class S3BitStoreService.S3LazyInputStream extends InputStream
This inner class represent an InputStream that uses temporary files to represent chunk of the object downloaded from S3. When the input stream is read the class look first to the current chunk and download a new one once if the current one as been fully read. The class is responsible to close a chunk as soon as a new one is retrieved, the last chunk is closed when the input stream itself is closed or the last byte is read (the first of the two)
-
-
Constructor Summary
Constructors Constructor Description S3LazyInputStream(String objectKey, long chunkMaxSize, long fileSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intread()-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
S3LazyInputStream
public S3LazyInputStream(String objectKey, long chunkMaxSize, long fileSize) throws IOException
- Throws:
IOException
-
-
Method Detail
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
-