Class FileUtils
java.lang.Object
org.apache.commons.configuration2.io.FileUtils
This class is a subset of org.apache.commons.io.FileUtils, git-svn-id:
https://svn.apache.org/repos/asf/commons/proper/io/trunk@1423916 13f79535-47bb-0310-9956-ffa450edef68. The subset is
determined by
See CONFIGURATION-521 for a discussion.
FileLocatorUtils
. The copied constants and methods are literally copied.See CONFIGURATION-521 for a discussion.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
UTF8
The UTF-8 character set, used to decode octets in URLs.
-
-
Constructor Details
-
FileUtils
FileUtils()
-
-
Method Details
-
decodeUrl
Decodes the specified URL as per RFC 3986, i.e. transforms percent-encoded octets to characters by decoding with the UTF-8 character set. This function is primarily intended for usage withURL
which unfortunately does not enforce proper URLs. As such, this method will leniently accept invalid characters or malformed percent-encoded octets and simply pass them literally through to the result string. Except for rare edge cases, this will make unencoded URLs pass through unaltered.- Parameters:
url
- The URL to decode, may benull
.- Returns:
- The decoded URL or
null
if the input wasnull
.
-
toFile
Convert from aURL
to aFile
.From version 1.1 this method will decode the URL. Syntax such as
file:///my%20docs/file.txt
will be correctly decoded to/my docs/file.txt
. Starting with version 1.5, this method uses UTF-8 to decode percent-encoded octets to characters. Additionally, malformed percent-encoded octets are handled leniently by passing them through literally.- Parameters:
url
- the file URL to convert,null
returnsnull
- Returns:
- the equivalent
File
object, ornull
if the URL's protocol is notfile
-