DefaultFileSystem (Apache Commons Configuration 2.15.1 API)
Description: declaration: package: org.apache.commons.configuration2.io, class: DefaultFileSystem

Package org.apache.commons.configuration2.io

# 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

  Modifier and Type
  Method
  Description
  `String`
  `getBasePath(String path)`
  Gets the base path of the given path, for example a directory for a file.
  `String`
  `getFileName(String path)`
  Gets the file name of the given path.
  `InputStream`
  `getInputStream(URL url)`
  Gets an input stream for a URL.
  `InputStream`
  `getInputStream(URL url, URLConnectionOptions urlConnectionOptions)`
  Not abstract for binary compatibility.
  `OutputStream`
  `getOutputStream(File file)`
  Gets an output stream for a File.
  `OutputStream`
  `getOutputStream(URL url)`
  Gets an output stream for a URL.
  `String`
  `getPath(File file, URL url, String basePath, String fileName)`
  Gets a path string for the given input where some values may be null.
  `URL`
  `getURL(String basePath, String file)`
  Gets a URL for a base path and file name.
  `URL`
  `locateFromURL(String basePath, 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultFileSystem

    public DefaultFileSystem()
    Constructs a new instance.

- ## Method Details

  - ### getBasePath

    public String getBasePath(String path)
    Description copied from class: `FileSystem`
    Gets the base path of the given path, for example a directory for a file.
    Specified by:
      `getBasePath` in class `FileSystem`
    Parameters:
      `path` - the source path.
    Returns:
      the base path.

  - ### getFileName

    public String getFileName(String path)
    Description copied from class: `FileSystem`
    Gets the file name of the given path.
    Specified by:
      `getFileName` in class `FileSystem`
    Parameters:
      `path` - the source path.
    Returns:
      the file name.

  - ### getInputStream

    public InputStream getInputStream(URL url) throws ConfigurationException
    Description copied from class: `FileSystem`
    Gets an input stream for a URL.
    Specified by:
      `getInputStream` in class `FileSystem`
    Parameters:
      `url` - the source URL.
    Returns:
      an input stream.
    Throws:
      `ConfigurationException` - if an problem occurs getting the input stream.

  - ### getInputStream

    public InputStream getInputStream(URL url, URLConnectionOptions urlConnectionOptions) throws ConfigurationException
    Description copied from class: `FileSystem`
    Not abstract for binary compatibility.
    Overrides:
      `getInputStream` in class `FileSystem`
    Parameters:
      `url` - the URL of the file
      `urlConnectionOptions` - the URLConnection options
    Returns:
      the input stream for the specified URL
    Throws:
      `ConfigurationException` - if an error occurs while opening the file

  - ### getOutputStream

    public OutputStream getOutputStream(File file) throws ConfigurationException
    Description copied from class: `FileSystem`
    Gets an output stream for a File.
    Specified by:
      `getOutputStream` in class `FileSystem`
    Parameters:
      `file` - the source File.
    Returns:
      an output stream.
    Throws:
      `ConfigurationException` - if an problem occurs getting the output stream.

  - ### getOutputStream

    public OutputStream getOutputStream(URL url) throws ConfigurationException
    Description copied from class: `FileSystem`
    Gets an output stream for a URL.
    Specified by:
      `getOutputStream` in class `FileSystem`
    Parameters:
      `url` - the source URL.
    Returns:
      an output stream.
    Throws:
      `ConfigurationException` - if an problem occurs getting the output stream.

  - ### getPath

    public String getPath(File file, URL url, String basePath, String fileName)
    Description copied from class: `FileSystem`
    Gets a path string for the given input where some values may be null.

    The implementation decides on which argument take precedence.

    Specified by:
      `getPath` in class `FileSystem`
    Parameters:
      `file` - A file.
      `url` - A URL.
      `basePath` - A base path string.
      `fileName` - A file name.
    Returns:
      A path string.

  - ### getURL

    public URL getURL(String basePath, String file) throws MalformedURLException
    Description copied from class: `FileSystem`
    Gets a URL for a base path and file name.
    Specified by:
      `getURL` in class `FileSystem`
    Parameters:
      `basePath` - The base path.
      `file` - The file name.
    Returns:
      a URL.
    Throws:
      `MalformedURLException` - if a problem occurs creating the URL.

  - ### locateFromURL

    public URL locateFromURL(String basePath, String fileName)
    Description copied from class: `FileSystem`
    Locates a URL for a base path and file name.
    Specified by:
      `locateFromURL` in class `FileSystem`
    Parameters:
      `basePath` - The base path.
      `fileName` - The file name.
    Returns:
      a URL.