public interface FileLoader
FileDescriptor
s. Can be used on both middle and client tiers.Modifier and Type | Interface and Description |
---|---|
static class |
FileLoader.InputStreamSupplierException
Runtime exception that can be thrown from
Supplier<InputStream> implementation. |
static class |
FileLoader.RetryUnsupportedException
Exception that can be thrown if implementation of
Supplier<InputStream> cannot provide input stream
once again. |
static class |
FileLoader.SingleInputStreamSupplier
Simple implementation of
Supplier<InputStream> that can provide input stream only once. |
static interface |
FileLoader.StreamingProgressListener
Listener that is fired during file streaming to middleware.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
Modifier and Type | Method and Description |
---|---|
boolean |
fileExists(FileDescriptor fd)
Tests whether the file denoted by this file descriptor exists.
|
java.io.InputStream |
openStream(FileDescriptor fd)
Return an input stream to load a file contents from middleware.
|
void |
removeFile(FileDescriptor fd)
Remove a file from the file storage.
|
void |
saveStream(FileDescriptor fd,
java.util.function.Supplier<java.io.InputStream> inputStreamSupplier)
Save an InputStream contents into file storage on middleware.
|
void |
saveStream(FileDescriptor fd,
java.util.function.Supplier<java.io.InputStream> inputStreamSupplier,
FileLoader.StreamingProgressListener streamingListener)
Save an InputStream contents into file storage on middleware.
|
static final java.lang.String NAME
void saveStream(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier) throws FileStorageException
fd
- file descriptorinputStreamSupplier
- input stream supplier
May throw FileLoader.RetryUnsupportedException
if supplier cannot provide stream twice.
May throw FileLoader.InputStreamSupplierException
in case of exception in supplier.java.lang.IllegalArgumentException
- if arguments are incorrectFileStorageException
- if something goes wrongvoid saveStream(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, @Nullable FileLoader.StreamingProgressListener streamingListener) throws FileStorageException, java.lang.InterruptedException
fd
- file descriptorinputStreamSupplier
- input stream supplier.
May throw FileLoader.RetryUnsupportedException
if supplier cannot provide stream twice.
May throw FileLoader.InputStreamSupplierException
in case of exception in supplier.streamingListener
- streaming progress listenerjava.lang.IllegalArgumentException
- if arguments are incorrectFileStorageException
- if something goes wrongjava.lang.InterruptedException
- if current thread is interrupted during streaming processjava.io.InputStream openStream(FileDescriptor fd) throws FileStorageException
fd
- file descriptorjava.lang.IllegalArgumentException
- if arguments are incorrectFileStorageException
- if something goes wrongvoid removeFile(FileDescriptor fd) throws FileStorageException
fd
- file descriptorjava.lang.IllegalArgumentException
- if arguments are incorrectFileStorageException
- if something goes wrongboolean fileExists(FileDescriptor fd) throws FileStorageException
fd
- file descriptorjava.lang.IllegalArgumentException
- if arguments are incorrectFileStorageException
- if something goes wrong@throws FileStorageException