sk.baka.ambient.commons
Class ObjectStorage

java.lang.Object
  extended by sk.baka.ambient.commons.AbstractFileStorage
      extended by sk.baka.ambient.commons.ObjectStorage

public final class ObjectStorage
extends AbstractFileStorage

Stores objects as files. The file content is composed of a serialized form of the object.

Author:
Martin Vysny

Field Summary
 
Fields inherited from class sk.baka.ambient.commons.AbstractFileStorage
maxStorageSize, theCache
 
Constructor Summary
ObjectStorage(String ext)
          Creates new playlist storage.
 
Method Summary
 boolean contains(String name)
          Checks if a playlist with given name is present in the storage.
 void delete(String name)
          Deletes given playlist.
 Serializable loadObject(String name)
          Loads (deserializes) a stored playlist.
 void saveObject(String name, Serializable object)
          Stores (serializes) a stored playlist.
 
Methods inherited from class sk.baka.ambient.commons.AbstractFileStorage
cleanup, close, createFile, fetchFileAsync, getCacheFile, getCacheFileNull, getFile, getFilenameAndExt, getNames, isFull, isProceedWithDownload, onFileDownloaded, purge, registerFile, removeFile, setMaxStorageSize, supportsExtension, toURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectStorage

public ObjectStorage(String ext)
Creates new playlist storage.

Parameters:
ext - the extension in the form ".ext"
Method Detail

loadObject

public Serializable loadObject(String name)
                        throws IOException
Loads (deserializes) a stored playlist.

Parameters:
name - the name
Returns:
deserialized player state.
Throws:
IOException - if something happens during the deserialization.

saveObject

public void saveObject(String name,
                       Serializable object)
                throws IOException
Stores (serializes) a stored playlist.

Parameters:
name - the name
object - the object to serialize.
Throws:
IOException - if something happens during the deserialization.

contains

public boolean contains(String name)
Checks if a playlist with given name is present in the storage.

Parameters:
name - the file name
Returns:
true if such playlist is available, false otherwise.

delete

public void delete(String name)
Deletes given playlist. Does nothing if the file does not exist.

Parameters:
name - the file name


Copyright © 2007-2008. All Rights Reserved.