public abstract class FileBasedUploadFilter extends Object implements UploadFilter, SetServiceLocatorCallback
UploadFilter
.Constructor and Description |
---|
FileBasedUploadFilter() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Callback method which may be used to do some clean up.
|
abstract void |
doFilter(File tempFile)
IOException indicates to not store the File tempFile in the repository
|
protected de.espirit.firstspirit.access.ServiceLocator |
getServiceLocator()
Gets the current service locator.
|
protected void |
init()
Method stub.
|
void |
initUploadFilter(InputStream in,
String extension)
Creates a new tempfile with the given extension and copies the given inputstream to this tempfile.
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into an array of bytes.
|
void |
setServiceLocator(de.espirit.firstspirit.access.ServiceLocator value)
Set a service locator which will be used to lookup a service.
|
public final void setServiceLocator(@NotNull de.espirit.firstspirit.access.ServiceLocator value)
setServiceLocator
in interface SetServiceLocatorCallback
value
- protected void init()
protected de.espirit.firstspirit.access.ServiceLocator getServiceLocator()
public void initUploadFilter(@NotNull InputStream in, @NotNull String extension) throws IOException
initUploadFilter
in interface UploadFilter
in
- input stream containing the dataextension
- file extension - it is not save to guess the file content from this extensionIOException
- indicates to not store the File tempFile in the repositorypublic abstract void doFilter(File tempFile) throws IOException
tempFile
- the temp fileIOException
- indicates to not store the File tempFile in the repositorypublic int read(@NotNull byte[] b, int off, int len) throws IOException
InputStream.read(byte[], int, int)
.read
in interface UploadFilter
b
- the bytes to readoff
- the offsetlen
- the lengthIOException
- on any errorpublic void close()
UploadFilter.initUploadFilter(java.io.InputStream, String)
.
Closes the stream and the tempfile used for this file based implementation.close
in interface UploadFilter
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210