org.sapia.filestorm
Interface Store

All Known Implementing Classes:
CachingFileStore, FileStore, StoreClient

public interface Store

This interface specifies the common behavior of store implementations.

Author:
yduchesne

Method Summary
 void close()
          Closes this instance.
 boolean contains(String name)
           
 void delete(String name)
           
 InputStream get(String name)
           
 void get(String name, OutputStream os)
          Streams the data corresponding to the given name into the given stream.
 long getContentLength(String name)
           
 long getLastModified(String name)
           
 String[] list(String baseName)
          Returns the list of names corresponding to stored data, relative to the given base name.
 void put(String name, InputStream is)
          Stores the data corresponding to the given stream under the named passed in.
 

Method Detail

put

void put(String name,
         InputStream is)
         throws IOException
Stores the data corresponding to the given stream under the named passed in. The stream is closed by this method.

Parameters:
name - the name under which to keep the passed in data.
is - an InputStream containing data to save.
Throws:
IOException - if an IO problem occurs while performing this operation.

get

void get(String name,
         OutputStream os)
         throws IOException,
                FileNotFoundException
Streams the data corresponding to the given name into the given stream. The stream is closed by this method.

Parameters:
name - the name corresponding to the data to retrieve.
os - an OutputStream to which the data is to be written.
Throws:
IOException - if an IO problem occurs while performing this operation.
FileNotFoundException - if no data exists for the given name.

get

InputStream get(String name)
                throws IOException,
                       FileNotFoundException
Parameters:
name - the name corresponding to the data to retrieve.
Returns:
the stream of data corresponding to the given name.
Throws:
IOException - if an IO problem occurs while performing this operation.
FileNotFoundException - if no data exists for the given name.

delete

void delete(String name)
            throws IOException
Parameters:
name - the name corresponding to the data to delete.
Throws:
IOException - if an IO problem occurs while performing this operation.

contains

boolean contains(String name)
                 throws IOException
Parameters:
name - the name corresponding to the data whose existence must be checked.
Returns:
true if data exists for the given name, false otherwise.
Throws:
IOException

list

String[] list(String baseName)
              throws IOException
Returns the list of names corresponding to stored data, relative to the given base name. For example, given the following full name: some/path/to/file, the file fragment will be relative to some/path/to (therefore, passing some/path/to as a base name to this method would return all names immediately "under" that base name).

If the passed in base name is null or is an empty string, then the returned names will be returned relatively to the "root" of this instance.

Parameters:
baseName - a base name.
Returns:
an array containing the names corresponding to data stored under the given base name.
Throws:
IOException

close

void close()
Closes this instance.


getContentLength

long getContentLength(String name)
                      throws FileNotFoundException,
                             IOException
Parameters:
name - the name corresponding to the data whose length must be returned.
Returns:
a length, in bytes.
Throws:
FileNotFoundException
IOException

getLastModified

long getLastModified(String name)
                     throws FileNotFoundException,
                            IOException
Parameters:
name - the name corresponding to the data whose timestamp must be returned..
Returns:
the time, in millis, at which the data was last modified.
Throws:
FileNotFoundException
IOException


Copyright © 2007 Sapia Open Community, Inc. All Rights Reserved.