java.lang.Object | ||
↳ | com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy | |
↳ | com.thoughtworks.xstream.persistence.FilePersistenceStrategy |
PersistenceStrategy to assign keys with single value to objects persisted in files. The
default naming strategy is based on the key's type and its SingleValueConverter
. It
escapes all characters that are normally illegal in the most common file systems. Such a
character is escaped with percent escaping as it is done by URL encoding. The XStream used to
marshal the values is also requested for the key's SingleValueConverter. A
StreamException
is thrown if no such converter is registered.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new FilePersistenceStrategy.
| |||||||||||
Create a new FilePersistenceStrategy with a provided XStream instance.
| |||||||||||
Create a new FilePersistenceStrategy with a provided XStream instance and the characters
to encode.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Given a filename, the unescape method returns the key which originated it.
| |||||||||||
Given a key, the escape method returns the filename which shall be used.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.thoughtworks.xstream.persistence.AbstractFilePersistenceStrategy
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.thoughtworks.xstream.persistence.PersistenceStrategy
|
Create a new FilePersistenceStrategy. Use a standard XStream instance with a
DomDriver
.
baseDirectory | the directory for the serialized values |
---|
Create a new FilePersistenceStrategy with a provided XStream instance.
baseDirectory | the directory for the serialized values |
---|---|
xstream | the XStream instance to use for (de)serialization |
Create a new FilePersistenceStrategy with a provided XStream instance and the characters to encode.
baseDirectory | the directory for the serialized values |
---|---|
xstream | the XStream instance to use for (de)serialization |
encoding | encoding used to write the files |
illegalChars | illegal characters for file names (should always include '%' as long as you do not overwrite the (un)escape methods) |
Given a filename, the unescape method returns the key which originated it.
name | the filename |
---|
Given a key, the escape method returns the filename which shall be used.
key | the key |
---|