Top Description Constructors Methods
com.thoughtworks.xstream.persistence

public Class FileStreamStrategy

extends AbstractFilePersistenceStrategy
implements StreamStrategy
Class Inheritance
All Implemented Interfaces
com.thoughtworks.xstream.persistence.StreamStrategy, com.thoughtworks.xstream.persistence.PersistenceStrategy
Imports
com.thoughtworks.xstream.XStream, java.io.File

Deprecated

As of 1.3.1, use FilePersistenceStrategy

PersistenceStrategy to assign string based keys to objects persisted in files. The file naming strategy is based on the key's type name and its toString method. It escapes non digit, non a-z and A-Z characters. In order to change the escaping/unescaping algorithm, simply extend this class and rewrite its getName/extractKey methods. Note, this implementation silently implies that the keys actually are Strings, since the keys will be turned into string keys at deserialization time.
Author
Guilherme Silveira

Constructor Summary

AccessConstructor and Description
public
FileStreamStrategy(final File baseDirectory)

public
FileStreamStrategy(final File baseDirectory, final XStream xstream)

Method Summary

Modifier and TypeMethod and Description
protected String
escape(final String key)

protected Object

Returns:

the original key
extractKey
(final String
the filename
name
)

Implements abstract com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy.extractKey.

Given a filename, the unescape method returns the key which originated it.
protected String

Returns:

the desired and escaped filename
getName
(final Object
the key
key
)

Implements abstract com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy.getName.

Given a key, the escape method returns the filename which shall be used.
protected String
unescape(final String name)

Inherited from com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy:
containsKeygetgetConverterLookupgetMapperisValiditeratorputremovesize

Constructor Detail

FileStreamStrategyback to summary
public FileStreamStrategy(final File baseDirectory)
FileStreamStrategyback to summary
public FileStreamStrategy(final File baseDirectory, final XStream xstream)

Method Detail

escapeback to summary
protected String escape(final String key)
extractKeyback to summary
protected Object extractKey(final String name)

Implements abstract com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy.extractKey.

Given a filename, the unescape method returns the key which originated it.

Parameters
name:String

the filename

Returns:Object

the original key

getNameback to summary
protected String getName(final Object key)

Implements abstract com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy.getName.

Given a key, the escape method returns the filename which shall be used.

Parameters
key:Object

the key

Returns:String

the desired and escaped filename

unescapeback to summary
protected String unescape(final String name)