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
ConversionException is thrown if no such converter is registered.
| Modifier and Type | Field and Description |
|---|---|
| private final String |
| Access | Constructor and Description |
|---|---|
| public | FilePersistenceStrategy(final File
the directory for the serialized values baseDirectory)Create a new FilePersistenceStrategy. |
| public | FilePersistenceStrategy(final File
the directory for the serialized values baseDirectory, final XStream the XStream instance to use for (de)serialization xstream)Create a new FilePersistenceStrategy with a provided XStream instance. |
| public | FilePersistenceStrategy(final File
the directory for the serialized values baseDirectory, final XStream the XStream instance to use for (de)serialization xstream, final String encoding used to write the files encoding, final String illegal characters for file names (should always include '%' as long as you do not overwrite
the (un)escape methods) illegalChars)Create a new FilePersistenceStrategy with a provided XStream instance and the characters to encode. |
| Modifier and Type | Method and Description |
|---|---|
| protected String | |
| protected Object | Returns: the original keythe filename name)Implements abstract com. |
| protected String | Returns: the desired and escaped filenamethe key key)Implements abstract com. |
| protected boolean | isValid(final File dir, final String name)
Overrides com. |
| protected String |
| illegalChars | back to summary |
|---|---|
| private final String illegalChars | |
| FilePersistenceStrategy | back to summary |
|---|---|
| public FilePersistenceStrategy(final File baseDirectory) Create a new FilePersistenceStrategy. Use a standard XStream instance with a
| |
| FilePersistenceStrategy | back to summary |
|---|---|
| public FilePersistenceStrategy(final File baseDirectory, final XStream xstream) Create a new FilePersistenceStrategy with a provided XStream instance. | |
| FilePersistenceStrategy | back to summary |
|---|---|
| public FilePersistenceStrategy(final File baseDirectory, final XStream xstream, final String encoding, final String illegalChars) Create a new FilePersistenceStrategy with a provided XStream instance and the characters to encode.
| |
| escape | back to summary |
|---|---|
| protected String escape(final String key) | |
| extractKey | back to summary |
|---|---|
| protected Object extractKey(final String name) Implements abstract com. Given a filename, the unescape method returns the key which originated it. | |
| getName | back to summary |
|---|---|
| protected String getName(final Object key) Implements abstract com. Given a key, the escape method returns the filename which shall be used. | |
| isValid | back to summary |
|---|---|
| protected boolean isValid(final File dir, final String name) Overrides com. | |
| unescape | back to summary |
|---|---|
| protected String unescape(String name) | |