com.binaryfantasy.murq.source
Interface ISource

All Known Implementing Classes:
DBSource, FSSource, MemorySource, MurqSource, ZipSource

public interface ISource

A ISource is any type of persistant storage that can have content in binary format streamed into it and associated with a unique key, then stream the same binary content back from the same key.

Author:
Bill Weiss

Method Summary
 void close()
          Called when a source is no longer to be used and provides a chance for clean up and release of resources.
 InputStream getInputStream(String key)
          Returns a stream to read the content specified by the key, or null if no content is associated with the key.
 Set<String> getKeys()
          Returns a Set of all current keys in this source, or an empty Set if there are none.
 OutputStream getOutputStream(String key)
          Returns a stream to write the content associated with the key.
 boolean remove(String key)
          Returns true if the content mapped to the provided key was removed, false if no content is associated with the key.
 

Method Detail

close

void close()
           throws IOException
Called when a source is no longer to be used and provides a chance for clean up and release of resources.

Throws:
IOException - if there is a problem during closing.

getKeys

Set<String> getKeys()
                    throws IOException
Returns a Set of all current keys in this source, or an empty Set if there are none.

Returns:
a Set of all current keys in this source, or an empty Set if there are none.
Throws:
IOException - if there is a problem reading the keys.

remove

boolean remove(String key)
               throws IOException
Returns true if the content mapped to the provided key was removed, false if no content is associated with the key.

Parameters:
key - unique value associated with the content.
Returns:
true if the content mapped to the provided key was removed, false if no content is associated with the key.
Throws:
IOException - if an error occurred while trying to remove the content.

getInputStream

InputStream getInputStream(String key)
                           throws IOException
Returns a stream to read the content specified by the key, or null if no content is associated with the key.

Parameters:
key - unique value associated with the content.
Returns:
a stream to read the content specified by the key, or null if no content is associated with the key.
Throws:
IOException - if there is an error while getting the content stream for reading.

getOutputStream

OutputStream getOutputStream(String key)
                             throws IOException
Returns a stream to write the content associated with the key.

Parameters:
key - unique value associated with the content.
Returns:
a stream to write the content associated with the key.
Throws:
IOException - if there is an error while getting the content stream for writing.


Copyright (c) 2000-2006, BinaryFantasy.com