|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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:) and
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 LocatorFile
, one LocatorClassLoader
and
one LocatorURL
Main operations:
*
LocationMapper
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 LocatorFile
also supports the idea of "current directory".
LocationMapper
,
FileUtils
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(FileManager filemanager)
Deprecated. Call filemanager.clone() to get a duplicate FileManager. |
|
FileManager(LocationMapper _mapper)
Create with the given location mapper |
Method Summary | |
---|---|
void |
addCacheModel(String uri,
Model m)
|
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 |
addLocatorURL()
Add a URL locator |
void |
addLocatorZip(String zfn)
Add a zip file locator |
FileManager |
clone()
|
static FileManager |
get()
Get the global file manager. |
boolean |
getCachingModels()
Deprecated. Use isCachingModels() |
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)
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<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)
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 |
String |
readWholeFileAsUTF8(String filename)
Slurp up a whole file: map filename as necessary |
String |
remap(String filenameOrURI)
Deprecated. Use mapURI |
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 |
setMapper(LocationMapper _mapper)
Deprecated. Use setLocationMapper |
void |
setModelCaching(boolean state)
Change the state of model cache : does not clear the cache |
static void |
setStdLocators(FileManager fMgr)
Force a file handler to have the default configuration. |
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()
@Deprecated public FileManager(FileManager filemanager)
filemanager
- public FileManager(LocationMapper _mapper)
Method Detail |
---|
public static FileManager get()
public static void setGlobalFileManager(FileManager globalFileManager)
globalFileManager
- public FileManager clone()
clone
in class Object
public static FileManager makeGlobal()
public static void setStdLocators(FileManager fMgr)
@Deprecated public void setMapper(LocationMapper _mapper)
public void setLocationMapper(LocationMapper _mapper)
public LocationMapper getLocationMapper()
public Iterator<Locator> locators()
public void addLocator(Locator loc)
public void addLocatorFile()
public void addLocatorFile(String dir)
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)
@Deprecated public boolean getCachingModels()
public boolean isCachingModels()
public Model getFromCache(String filenameOrURI)
public boolean hasCachedModel(String filenameOrURI)
public void addCacheModel(String uri, Model m)
public void removeCacheModel(String uri)
public Model loadModel(String filenameOrURI)
filenameOrURI
- The filename or a URI (file:, http:)
JenaException
- if there is syntax error in file.public Model loadModel(String filenameOrURI, String rdfSyntax)
filenameOrURI
- 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)
filenameOrURI
- 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 readModel(Model model, String filenameOrURI)
model
- filenameOrURI
-
JenaException
- if there is syntax error in file.public Model readModel(Model model, String filenameOrURI, String rdfSyntax)
model
- filenameOrURI
- rdfSyntax
- RDF Serialization syntax.
JenaException
- if there is syntax error in file.public Model readModel(Model model, String filenameOrURI, String baseURI, String syntax)
model
- filenameOrURI
- baseURI
- syntax
-
JenaException
- if there is syntax error in file.public InputStream open(String filenameOrURI)
@Deprecated public String remap(String filenameOrURI)
public String mapURI(String filenameOrURI)
public String readWholeFileAsUTF8(InputStream in)
public String readWholeFileAsUTF8(String filename)
public InputStream openNoMap(String filenameOrURI)
public TypedStream openNoMapOrNull(String filenameOrURI)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |