public class FSContentResolver extends Object implements ContentResolver
ContentResolver
implementation to read content from the File System.
The optional Path Prefix is "file:".
Absolute Windows paths contains a ":".
Absolute Unix paths starts with "/".
Other Paths are relative and uses the getRootFolder()
as root.
Which is per default new File(".")
.
Modifier and Type | Field and Description |
---|---|
static String |
FILE_URL_PREFIX
Pseudo URL prefix for loading from the class path: "classpath:".
|
Constructor and Description |
---|
FSContentResolver() |
Modifier and Type | Method and Description |
---|---|
void |
addContentResolver(ContentResolver contentResolver)
Some Implementations of a
ContentResolver are delegating the functionality
to other ContentResolvers. |
byte[] |
getContent(String key)
Reads the Content for the given Key or null if nothing where found.
|
File |
getRootFolder()
return the root of this FileSystem ContenResolver.
|
void |
setContent(String key,
byte[] value) |
void |
setRootFolderPath(String rootFolderPath) |
public static final String FILE_URL_PREFIX
public void addContentResolver(ContentResolver contentResolver)
ContentResolver
are delegating the functionality
to other ContentResolvers.UnionContentResolver
-------------------------------------- <contentResolver name="DefaultContentResolver" class="org.settings4j.contentresolver.UnionContentResolver"> <contentResolver-ref ref="FSContentResolver" /> <contentResolver-ref ref="ClasspathContentResolver" /> </contentResolver> --------------------------------------
addContentResolver
in interface ContentResolver
contentResolver
- the original contentResolver to delegate.public byte[] getContent(String key)
getContent
in interface ContentResolver
key
- The keypublic void setContent(String key, byte[] value) throws IOException
key
- The Settings4j Key.value
- The value to Store.IOException
- if an error occured.public File getRootFolder()
if no one is set, the "." will be returned.
public void setRootFolderPath(String rootFolderPath)
rootFolderPath
- the root folder Path.Copyright © 2008–2014. All rights reserved.