@Component(value="cuba_FileLoader") public class FileLoaderImpl extends java.lang.Object implements FileLoader
FileLoader.InputStreamSupplierException, FileLoader.RetryUnsupportedException, FileLoader.SingleInputStreamSupplier, FileLoader.StreamingProgressListener
Modifier and Type | Field and Description |
---|---|
protected EntityStates |
entityStates |
protected FileStorageAPI |
fileStorageAPI |
protected Persistence |
persistence |
NAME
Constructor and Description |
---|
FileLoaderImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkIfFileDescriptorExists(FileDescriptor fd) |
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.
|
@Inject protected FileStorageAPI fileStorageAPI
@Inject protected Persistence persistence
@Inject protected EntityStates entityStates
public void saveStream(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier) throws FileStorageException
FileLoader
saveStream
in interface FileLoader
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.FileStorageException
- if something goes wrongpublic void saveStream(FileDescriptor fd, java.util.function.Supplier<java.io.InputStream> inputStreamSupplier, @Nullable FileLoader.StreamingProgressListener streamingListener) throws FileStorageException, java.lang.InterruptedException
FileLoader
saveStream
in interface FileLoader
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 listenerFileStorageException
- if something goes wrongjava.lang.InterruptedException
- if current thread is interrupted during streaming processpublic java.io.InputStream openStream(FileDescriptor fd) throws FileStorageException
FileLoader
openStream
in interface FileLoader
fd
- file descriptorFileStorageException
- if something goes wrongpublic void removeFile(FileDescriptor fd) throws FileStorageException
FileLoader
removeFile
in interface FileLoader
fd
- file descriptorFileStorageException
- if something goes wrongpublic boolean fileExists(FileDescriptor fd) throws FileStorageException
FileLoader
fileExists
in interface FileLoader
fd
- file descriptorFileStorageException
- if something goes wrong@throws FileStorageExceptionprotected void checkIfFileDescriptorExists(FileDescriptor fd) throws FileStorageException
FileStorageException