Methods Summary |
---|
public synchronized java.lang.Object | get(java.lang.String key)Get the object associated to the given unique key.
try
{
final InputStream inputStream = getInputStream( key );
if( inputStream == null )
throw new NullPointerException("Null input stream returned for key: " + key );
try
{
final ObjectInputStream stream = new ObjectInputStream( inputStream );
if( stream == null )
throw new NullPointerException("Null stream returned for key: " + key );
final Object object = stream.readObject();
if( DEBUG )
{
getLogger().debug( "returning object " + object + " for key " + key );
}
return object;
}
finally
{
inputStream.close();
}
}
catch( final Throwable e )
{
throw new RuntimeException(
"Exception caught while retrieving an object, cause: " + e.toString() );
}
|
public synchronized java.lang.Object | get(java.lang.String key, java.lang.ClassLoader classLoader)
try
{
final InputStream inputStream = getInputStream( key );
if( inputStream == null )
throw new NullPointerException("Null input stream returned for key: " + key );
try
{
final ObjectInputStream stream = new ClassLoaderObjectInputStream( classLoader, inputStream );
if( stream == null )
throw new NullPointerException("Null stream returned for key: " + key );
final Object object = stream.readObject();
if( DEBUG )
{
getLogger().debug( "returning object " + object + " for key " + key );
}
return object;
}
finally
{
inputStream.close();
}
}
catch( final Throwable e )
{
throw new RuntimeException( "Exception caught while retrieving an object: " + e );
}
|
protected java.lang.String | getExtensionDecorator()
return ".FileObjectStore";
|
public synchronized void | put(java.lang.String key, java.lang.Object value)Store the given object and associates it to the given key
try
{
final OutputStream outputStream = getOutputStream( key );
try
{
final ObjectOutputStream stream = new ObjectOutputStream( outputStream );
stream.writeObject( value );
if( DEBUG ) getLogger().debug( "storing object " + value + " for key " + key );
}
finally
{
outputStream.close();
}
}
catch( final Exception e )
{
throw new RuntimeException( "Exception caught while storing an object: " + e );
}
|