public class FileManagerImpl extends Object implements FileManager
LocatorFile, one LocatorClassLoader and
one LocatorURL
Main operations:
* LocationMapperLocationMapper 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 LocatorFile also supports the idea of "current directory".LocationMapper,
FileUtilsfilePathSeparator, logAllLookups, PATH_DELIMITER| Modifier and Type | Method and Description |
|---|---|
void |
addCacheModel(String uri,
Model m) |
void |
addLocator(Locator loc)
Add a locator to the end of the locators list
|
void |
addLocatorClassLoader(ClassLoader cLoad)
Deprecated.
|
void |
addLocatorFile()
Deprecated.
|
void |
addLocatorFile(String dir)
Deprecated.
|
void |
addLocatorURL()
Deprecated.
|
void |
addLocatorZip(String zfn)
Deprecated.
|
FileManager |
clone() |
static FileManager |
get()
Get the global file manager.
|
Model |
getFromCache(String filenameOrURI)
Read out of the cache - return null if not in the cache
|
LocationMapper |
getLocationMapper()
Get the location mapping
|
boolean |
hasCachedModel(String filenameOrURI) |
boolean |
isCachingModels()
return whether caching is on of off
|
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).
|
Model |
loadModelInternal(String filenameOrURI)
Load a model from a file (local or remote).
|
Iterator<Locator> |
locators()
Return an iterator over all the handlers
|
static FileManager |
makeGlobal()
Create a "standard" FileManager.
|
String |
mapURI(String filenameOrURI)
Apply the mapping of a filename or URI
|
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
|
TypedStream |
openNoMapOrNull(String filenameOrURI)
Open a file using the locators of this FileManager
but without location mapping.
|
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.
|
Model |
readModelInternal(Model model,
String filenameOrURI)
Read a file of RDF into a model.
|
String |
readWholeFileAsUTF8(InputStream in)
Slurp up a whole file
|
String |
readWholeFileAsUTF8(String filename)
Slurp up a whole file: map filename as necessary
|
void |
remove(Locator loc)
Remove a locator
|
void |
removeCacheModel(String uri) |
void |
resetCache()
Reset the model cache
|
static void |
setGlobalFileManager(FileManager globalFileManager)
Set the global file manager (as returned by get())
If called before any call to get(), then the usual default filemanager is not created
|
void |
setLocationMapper(LocationMapper _mapper)
Set the location mapping
|
void |
setModelCaching(boolean state)
Change the state of model cache : does not clear the cache
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, createStd, getInternal, loadModel, readModelpublic static FileManager get()
get in interface FileManagerpublic static void setGlobalFileManager(FileManager globalFileManager)
setGlobalFileManager in interface FileManagerglobalFileManager - public FileManager clone()
clone in interface FileManagerclone in class Objectpublic static FileManager makeGlobal()
public void setLocationMapper(LocationMapper _mapper)
setLocationMapper in interface FileManagerpublic LocationMapper getLocationMapper()
getLocationMapper in interface FileManagerpublic Iterator<Locator> locators()
locators in interface FileManagerpublic void addLocator(Locator loc)
addLocator in interface FileManager@Deprecated public void addLocatorFile()
addLocatorFile in interface FileManager@Deprecated public void addLocatorFile(String dir)
addLocatorFile in interface FileManager@Deprecated public void addLocatorClassLoader(ClassLoader cLoad)
addLocatorClassLoader in interface FileManager@Deprecated public void addLocatorURL()
addLocatorURL in interface FileManager@Deprecated public void addLocatorZip(String zfn)
addLocatorZip in interface FileManagerpublic void remove(Locator loc)
remove in interface FileManagerpublic void resetCache()
resetCache in interface FileManagerpublic void setModelCaching(boolean state)
setModelCaching in interface FileManagerpublic boolean isCachingModels()
isCachingModels in interface FileManagerpublic Model getFromCache(String filenameOrURI)
getFromCache in interface FileManagerpublic boolean hasCachedModel(String filenameOrURI)
hasCachedModel in interface FileManagerpublic void addCacheModel(String uri, Model m)
addCacheModel in interface FileManagerpublic void removeCacheModel(String uri)
removeCacheModel in interface FileManagerpublic Model loadModelInternal(String filenameOrURI)
loadModelInternal in interface FileManagerfilenameOrURI - The filename or a URI (file:, http:)JenaException - if there is syntax error in file.public Model loadModel(String filenameOrURI, String rdfSyntax)
loadModel in interface FileManagerfilenameOrURI - The filename or a URI (file:, http:)rdfSyntax - RDF Serialization syntax.JenaException - if there is syntax error in file.public Model loadModel(String filenameOrURI, String baseURI, String rdfSyntax)
loadModel in interface FileManagerfilenameOrURI - The filename or a URI (file:, http:)baseURI - Base URI for loading the RDF model.rdfSyntax - RDF Serialization syntax.JenaException - if there is syntax error in file.public Model readModelInternal(Model model, String filenameOrURI)
readModelInternal in interface FileManagermodel - filenameOrURI - JenaException - if there is syntax error in file.public Model readModel(Model model, String filenameOrURI, String rdfSyntax)
readModel in interface FileManagermodel - filenameOrURI - rdfSyntax - RDF Serialization syntax.JenaException - if there is syntax error in file.public Model readModel(Model model, String filenameOrURI, String baseURI, String syntax)
readModel in interface FileManagermodel - filenameOrURI - baseURI - syntax - JenaException - if there is syntax error in file.public InputStream open(String filenameOrURI)
open in interface FileManagerpublic String mapURI(String filenameOrURI)
mapURI in interface FileManagerpublic String readWholeFileAsUTF8(InputStream in)
readWholeFileAsUTF8 in interface FileManagerpublic String readWholeFileAsUTF8(String filename)
readWholeFileAsUTF8 in interface FileManagerpublic InputStream openNoMap(String filenameOrURI)
openNoMap in interface FileManagerpublic TypedStream openNoMapOrNull(String filenameOrURI)
openNoMapOrNull in interface FileManagerLicenced under the Apache License, Version 2.0