Package org.apache.commons.configuration
Class FileSystem
java.lang.Object
org.apache.commons.configuration.FileSystem
- Direct Known Subclasses:
DefaultFileSystem
Abstract layer to allow various types of file systems.
- Since:
- 1.7
- Version:
- $Id: FileSystem.java 1209996 2011-12-03 20:24:21Z oheger $
- Author:
- Commons Configuration team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract String
getBasePath
(String path) static FileSystem
Retrieve the FileSystem being used.abstract String
getFileName
(String path) abstract InputStream
getInputStream
(String basePath, String fileName) abstract InputStream
getInputStream
(URL url) org.apache.commons.logging.Log
Returns the logger used by this FileSystem.abstract OutputStream
getOutputStream
(File file) abstract OutputStream
getOutputStream
(URL url) abstract String
abstract URL
abstract URL
locateFromURL
(String basePath, String fileName) static void
Reset the FileSystem to the default.static void
Set the FileSystem to use.void
setFileOptionsProvider
(FileOptionsProvider provider) Set the FileOptionsProvidervoid
setLogger
(org.apache.commons.logging.Log log) Allows to set the logger to be used by this FileSystem.
-
Constructor Details
-
FileSystem
public FileSystem()
-
-
Method Details
-
getLogger
Returns the logger used by this FileSystem.- Returns:
- the logger
-
setLogger
Allows to set the logger to be used by this FileSystem. This method makes it possible for clients to exactly control logging behavior. Per default a logger is set that will ignore all log messages. Derived classes that want to enable logging should call this method during their initialization with the logger to be used.- Parameters:
log
- the new logger
-
setDefaultFileSystem
Set the FileSystem to use.- Parameters:
fs
- The FileSystem- Throws:
NullPointerException
- if the FileSystem parameter is null.
-
resetDefaultFileSystem
Reset the FileSystem to the default. -
getDefaultFileSystem
Retrieve the FileSystem being used.- Returns:
- The FileSystem.
-
setFileOptionsProvider
Set the FileOptionsProvider- Parameters:
provider
- The FileOptionsProvider
-
getFileOptionsProvider
-
getInputStream
public abstract InputStream getInputStream(String basePath, String fileName) throws ConfigurationException - Throws:
ConfigurationException
-
getInputStream
- Throws:
ConfigurationException
-
getOutputStream
- Throws:
ConfigurationException
-
getOutputStream
- Throws:
ConfigurationException
-
getPath
-
getBasePath
-
getFileName
-
locateFromURL
-
getURL
- Throws:
MalformedURLException
-