public class AdapterFileManager extends FileManager
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".StreamManager
,
LocationMapper
,
FileUtils
filePathSeparator, PATH_DELIMITER
Constructor and Description |
---|
AdapterFileManager(FileManager filemanager)
Create a new file manager that is a copy of another.
|
AdapterFileManager(StreamManager streamManager) |
AdapterFileManager(StreamManager streamManager,
LocationMapper mapper)
Create a FileManger using a RIOT StreamManager and RIOT LocationMapper
|
Modifier and Type | Method and Description |
---|---|
void |
addCacheModel(String uri,
Model m) |
void |
addLocator(Locator oldloc)
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
|
static AdapterFileManager |
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
|
StreamManager |
getStreamManager()
Return the associate stream manager
|
boolean |
hasCachedModel(String filenameOrURI) |
boolean |
isCachingModels()
return whether caching is on of off
|
Iterator<Locator> |
locators()
Return an iterator over all the handlers
|
static AdapterFileManager |
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
Throws RiotNotFoundException if not found.
|
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
without location mapping.
|
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(AdapterFileManager 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
|
getCachingModels, loadModel, loadModel, loadModel, readModel, readModel, readModel, readWholeFileAsUTF8, readWholeFileAsUTF8, setGlobalFileManager, setMapper, setStdLocators
public AdapterFileManager(FileManager filemanager)
filemanager
- public AdapterFileManager(StreamManager streamManager)
public AdapterFileManager(StreamManager streamManager, LocationMapper mapper)
public static AdapterFileManager get()
public static void setGlobalFileManager(AdapterFileManager globalFileManager)
globalFileManager
- public static AdapterFileManager makeGlobal()
public StreamManager getStreamManager()
public void setLocationMapper(LocationMapper mapper)
setLocationMapper
in class FileManager
public LocationMapper getLocationMapper()
getLocationMapper
in class FileManager
public Iterator<Locator> locators()
locators
in class FileManager
public void remove(Locator loc)
remove
in class FileManager
public void addLocator(Locator oldloc)
addLocator
in class FileManager
public void addLocatorFile()
addLocatorFile
in class FileManager
public void addLocatorFile(String dir)
addLocatorFile
in class FileManager
public void addLocatorClassLoader(ClassLoader cLoad)
addLocatorClassLoader
in class FileManager
public void addLocatorURL()
addLocatorURL
in class FileManager
public void addLocatorZip(String zfn)
addLocatorZip
in class FileManager
public void resetCache()
resetCache
in class FileManager
public void setModelCaching(boolean state)
setModelCaching
in class FileManager
public boolean isCachingModels()
isCachingModels
in class FileManager
public Model getFromCache(String filenameOrURI)
getFromCache
in class FileManager
public boolean hasCachedModel(String filenameOrURI)
hasCachedModel
in class FileManager
public void addCacheModel(String uri, Model m)
addCacheModel
in class FileManager
public void removeCacheModel(String uri)
removeCacheModel
in class FileManager
public InputStream open(String filenameOrURI)
open
in class FileManager
public String mapURI(String filenameOrURI)
mapURI
in class FileManager
public InputStream openNoMap(String filenameOrURI)
openNoMap
in class FileManager
public TypedStream openNoMapOrNull(String filenameOrURI)
openNoMapOrNull
in class FileManager
@Deprecated public String remap(String filenameOrURI)
remap
in class FileManager
Licenced under the Apache License, Version 2.0