|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.hp.hpl.jena.util.FileManager
public class FileManager
FileManager A FileManager provides access to named file-like resources by opening InputStreams to things in the filing system, by URL (http: and file:) amd found by the classloader. It can also load RDF data from such a system resource into an existing model or create a new (Memory-based) model. There is a global FileManager which provide uniform access to system resources: applications may also create specialised FileManagers. A FileManager contains a list of location functions to try: the global FileManger has one @link{LocatorFile} and one @link{LocatorClassLoader}. A FileManager works in conjunction with a LocationMapper. A @link{LocationMapper} is a set of alternative locations for system resources and a set of alternative prefix locations. For example, a local copy of a common RDF dataset may be used whenever the usual URL is used by the application. The FileManager also supports the idea of "current directory". This only applies to the LocatorFile and not, for example, items found by a classloader.
LocationMapper
Field Summary | |
---|---|
static String |
filePathSeparator
|
static String |
PATH_DELIMITER
Delimiter between path entries : because URI scheme names use : we only allow ; |
Constructor Summary | |
---|---|
FileManager()
Create an uninitialized FileManager |
|
FileManager(LocationMapper _mapper)
Create with the given location mapper |
Method Summary | |
---|---|
void |
addLocator(Locator loc)
Add a locator to the end of the locators list |
void |
addLocatorClassLoader(ClassLoader cLoad)
Add a class loader locator |
void |
addLocatorFile()
Add a file locator |
void |
addLocatorFile(String dir)
Add a file locator which uses dir as its working directory |
void |
addLocatorSystemClassLoader()
Add the system class loader |
void |
addLocatorURL()
Add a URL locator |
void |
addLocatorZip(String zfn)
Add a zip file locator |
static FileManager |
get()
Get the global file manager. |
Model |
loadModel(String filenameOrURI)
Load a model from a file (local or remote). |
Model |
loadModel(String filenameOrURI,
String rdfSyntax)
Load a model from a file (local or remote). |
Model |
loadModel(String filenameOrURI,
String baseURI,
String rdfSyntax)
Load a model from a file (local or remote). |
Iterator |
locators()
Return an iterator over all the handlers |
InputStream |
open(String filenameOrURI)
Open a file using the locators of this FileManager |
InputStream |
openNoMap(String filenameOrURI)
Open a file using the locators of this FileManager but without location mapping |
Model |
readModel(Model model,
String filenameOrURI)
Read a file of RDF into a model. |
Model |
readModel(Model model,
String filenameOrURI,
String rdfSyntax)
Read a file of RDF into a model. |
Model |
readModel(Model model,
String filenameOrURI,
String baseURI,
String syntax)
Read a file of RDF into a model. |
String |
readWholeFileAsUTF8(InputStream in)
Slurp up a whole file: map filename as necessary |
String |
readWholeFileAsUTF8(String filename)
Slurp up a whole file: map filename as necessary |
String |
remap(String filenameOrURI)
Apply the mapping of a filename or URI |
void |
remove(Locator loc)
Remove a locator |
void |
resetCache()
Reset the model cache |
void |
setMapper(LocationMapper _mapper)
Set the location mapping |
void |
setModelCaching(boolean state)
Change the state of model cache : does not clear the cache |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PATH_DELIMITER
public static final String filePathSeparator
Constructor Detail |
---|
public FileManager()
public FileManager(LocationMapper _mapper)
Method Detail |
---|
public static FileManager get()
public void setMapper(LocationMapper _mapper)
public Iterator locators()
public void addLocator(Locator loc)
public void addLocatorFile()
public void addLocatorFile(String dir)
public void addLocatorSystemClassLoader()
public void addLocatorClassLoader(ClassLoader cLoad)
public void addLocatorURL()
public void addLocatorZip(String zfn)
public void remove(Locator loc)
public void resetCache()
public void setModelCaching(boolean state)
public Model loadModel(String filenameOrURI)
filenameOrURI
- The filename or a URI (file:, http:)
public Model loadModel(String filenameOrURI, String rdfSyntax)
filenameOrURI
- The filename or a URI (file:, http:)rdfSyntax
- RDF Serialization syntax.
public Model loadModel(String filenameOrURI, String baseURI, String rdfSyntax)
filenameOrURI
- The filename or a URI (file:, http:)baseURI
- Base URI for loading the RDF model.rdfSyntax
- RDF Serialization syntax.
public Model readModel(Model model, String filenameOrURI)
model
- filenameOrURI
-
public Model readModel(Model model, String filenameOrURI, String rdfSyntax)
model
- filenameOrURI
- rdfSyntax
- RDF Serialization syntax.
public Model readModel(Model model, String filenameOrURI, String baseURI, String syntax)
model
- filenameOrURI
- baseURI
- syntax
-
If
- syntax error in file.public InputStream open(String filenameOrURI)
public String remap(String filenameOrURI)
public String readWholeFileAsUTF8(InputStream in)
public String readWholeFileAsUTF8(String filename)
public InputStream openNoMap(String filenameOrURI)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |