FileDocCategorySizeDatePackage
File_Persistent_Stream_Repository.javaAPI DocApache James 2.3.13067Fri Jan 12 12:56:24 GMT 2007org.apache.james.mailrepository.filepair

File_Persistent_Stream_Repository

public class File_Persistent_Stream_Repository extends AbstractFileRepository implements org.apache.avalon.cornerstone.services.store.StreamRepository
Implementation of a StreamRepository to a File. TODO: -retieve(String key) should return a FilterInputStream to allow mark and reset methods. (working not like BufferedInputStream!!!)

Fields Summary
Constructors Summary
Methods Summary
public synchronized java.io.InputStreamget(java.lang.String key)
Get the object associated to the given unique key.

        try
        {
            return getInputStream( key );
        }
        catch( final IOException ioe )
        {
            final String message = "Exception caught while retrieving a stream ";
            getLogger().warn( message, ioe );
            throw new RuntimeException( message + ": " + ioe );
        }
    
protected java.lang.StringgetExtensionDecorator()

        return ".FileStreamStore";
    
public longgetSize(java.lang.String key)

        try {
            return getFile(key).length();
        }
        catch(IOException e) {
            return 0;
        }
    
public synchronized java.io.OutputStreamput(java.lang.String key)
Store the given object and associates it to the given key

        try
        {
            final OutputStream outputStream = getOutputStream( key );
            return new BufferedOutputStream( outputStream );
        }
        catch( final IOException ioe )
        {
            final String message = "Exception caught while storing a stream ";
            getLogger().warn( message, ioe );
            throw new RuntimeException( message + ": " + ioe );
        }