Class DefaultFileSystem
- java.lang.Object
-
- org.apache.commons.configuration2.io.FileSystem
-
- org.apache.commons.configuration2.io.DefaultFileSystem
-
- Direct Known Subclasses:
VFSFileSystem
public class DefaultFileSystem extends FileSystem
FileSystem that uses java.io.File or HttpClient.- Since:
- 1.7
-
-
Constructor Summary
Constructors Constructor Description DefaultFileSystem()Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBasePath(java.lang.String path)Gets the base path of the given path, for example a directory for a file.java.lang.StringgetFileName(java.lang.String path)Gets the file name of the given path.java.io.InputStreamgetInputStream(java.net.URL url)Gets an input stream for a URL.java.io.InputStreamgetInputStream(java.net.URL url, URLConnectionOptions urlConnectionOptions)Not abstract for binary compatibility.java.io.OutputStreamgetOutputStream(java.io.File file)Gets an output stream for a File.java.io.OutputStreamgetOutputStream(java.net.URL url)Gets an output stream for a URL.java.lang.StringgetPath(java.io.File file, java.net.URL url, java.lang.String basePath, java.lang.String fileName)Gets a path string for the given input where some values may be null.java.net.URLgetURL(java.lang.String basePath, java.lang.String file)Gets a URL for a base path and file name.java.net.URLlocateFromURL(java.lang.String basePath, java.lang.String fileName)Locates a URL for a base path and file name.-
Methods inherited from class org.apache.commons.configuration2.io.FileSystem
getFileOptionsProvider, getLogger, setFileOptionsProvider, setLogger
-
-
-
-
Method Detail
-
getBasePath
public java.lang.String getBasePath(java.lang.String path)
Description copied from class:FileSystemGets the base path of the given path, for example a directory for a file.- Specified by:
getBasePathin classFileSystem- Parameters:
path- the source path.- Returns:
- the base path.
-
getFileName
public java.lang.String getFileName(java.lang.String path)
Description copied from class:FileSystemGets the file name of the given path.- Specified by:
getFileNamein classFileSystem- Parameters:
path- the source path.- Returns:
- the file name.
-
getInputStream
public java.io.InputStream getInputStream(java.net.URL url) throws ConfigurationExceptionDescription copied from class:FileSystemGets an input stream for a URL.- Specified by:
getInputStreamin classFileSystem- Parameters:
url- the source URL.- Returns:
- an input stream.
- Throws:
ConfigurationException- if an problem occurs getting the input stream.
-
getInputStream
public java.io.InputStream getInputStream(java.net.URL url, URLConnectionOptions urlConnectionOptions) throws ConfigurationExceptionDescription copied from class:FileSystemNot abstract for binary compatibility.- Overrides:
getInputStreamin classFileSystem- Parameters:
url- the URL of the fileurlConnectionOptions- the URLConnection options- Returns:
- the input stream for the specified URL
- Throws:
ConfigurationException- if an error occurs while opening the file
-
getOutputStream
public java.io.OutputStream getOutputStream(java.io.File file) throws ConfigurationExceptionDescription copied from class:FileSystemGets an output stream for a File.- Specified by:
getOutputStreamin classFileSystem- Parameters:
file- the source File.- Returns:
- an output stream.
- Throws:
ConfigurationException- if an problem occurs getting the output stream.
-
getOutputStream
public java.io.OutputStream getOutputStream(java.net.URL url) throws ConfigurationExceptionDescription copied from class:FileSystemGets an output stream for a URL.- Specified by:
getOutputStreamin classFileSystem- Parameters:
url- the source URL.- Returns:
- an output stream.
- Throws:
ConfigurationException- if an problem occurs getting the output stream.
-
getPath
public java.lang.String getPath(java.io.File file, java.net.URL url, java.lang.String basePath, java.lang.String fileName)Description copied from class:FileSystemGets a path string for the given input where some values may be null.The implementation decides on which argument take precedence.
- Specified by:
getPathin classFileSystem- Parameters:
file- A file.url- A URL.basePath- A base path string.fileName- A file name.- Returns:
- A path string.
-
getURL
public java.net.URL getURL(java.lang.String basePath, java.lang.String file) throws java.net.MalformedURLExceptionDescription copied from class:FileSystemGets a URL for a base path and file name.- Specified by:
getURLin classFileSystem- Parameters:
basePath- The base path.file- The file name.- Returns:
- a URL.
- Throws:
java.net.MalformedURLException- if a problem occurs creating the URL.
-
locateFromURL
public java.net.URL locateFromURL(java.lang.String basePath, java.lang.String fileName)Description copied from class:FileSystemLocates a URL for a base path and file name.- Specified by:
locateFromURLin classFileSystem- Parameters:
basePath- The base path.fileName- The file name.- Returns:
- a URL.
-
-