de.espirit.firstspirit.server.mediamanagement
Class FileBasedUploadFilter

java.lang.Object
  extended by de.espirit.firstspirit.server.mediamanagement.FileBasedUploadFilter
All Implemented Interfaces:
SetServiceLocatorCallback, UploadFilter, Closeable

public abstract class FileBasedUploadFilter
extends Object
implements UploadFilter, SetServiceLocatorCallback

Example:
This is a basic example how to extend this class

Constructor Summary
FileBasedUploadFilter()
           
 
Method Summary
 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  ServiceLocator getServiceLocator()
           
protected  void init()
           
 void initUploadFilter(InputStream in, String extension)
          Initialize the filter instance.
 int read(byte[] b, int off, int len)
          See InputStream.read(byte[], int, int).
 void setServiceLocator(ServiceLocator value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileBasedUploadFilter

public FileBasedUploadFilter()
Method Detail

setServiceLocator

public final void setServiceLocator(@NotNull
                                    ServiceLocator value)
Specified by:
setServiceLocator in interface SetServiceLocatorCallback

init

protected void init()

getServiceLocator

protected ServiceLocator getServiceLocator()

initUploadFilter

public void initUploadFilter(@NotNull
                             InputStream in,
                             @NotNull
                             String extension)
                      throws IOException
Description copied from interface: UploadFilter
Initialize the filter instance. It is not allowed to change the content of the data provided by in.

Specified by:
initUploadFilter in interface UploadFilter
Parameters:
in - input stream containing the data
extension - file extension - it is not save to guess the file content from this extension
Throws:
IOException

doFilter

public abstract void doFilter(File tempFile)
                       throws IOException
IOException indicates to not store the File tempFile in the repository

Parameters:
tempFile -
Throws:
IOException

read

public int read(@NotNull
                byte[] b,
                int off,
                int len)
         throws IOException
Description copied from interface: UploadFilter
See InputStream.read(byte[], int, int).

Specified by:
read in interface UploadFilter
Throws:
IOException

close

public void close()
Description copied from interface: UploadFilter
Callback method which may be used to do some clean up. A call to this method should at least close the input stream provided in method UploadFilter.initUploadFilter(java.io.InputStream, String).

Specified by:
close in interface UploadFilter
Specified by:
close in interface Closeable


Copyright © 2012 e-Spirit AG. All Rights Reserved. Build 4.2.480