Package libcore.net.url
Class FileHandler
java.lang.Object
java.net.URLStreamHandler
libcore.net.url.FileHandler
public class FileHandler extends URLStreamHandler
This is the handler that is responsible for reading files from the file
system.
-
Constructor Summary
Constructors Constructor Description FileHandler() -
Method Summary
Modifier and Type Method Description URLConnectionopenConnection(URL url)Returns a connection to the a file pointed by thisURLin the file systemURLConnectionopenConnection(URL url, Proxy proxy)The behavior of this method is the same as openConnection(URL).protected voidparseURL(URL url, String spec, int start, int end)Parse thestringstr intoURLu which already have the context properties.Methods inherited from class java.net.URLStreamHandler
equals, getDefaultPort, getHostAddress, hashCode, hostsEqual, sameFile, setURL, setURL, toExternalForm
-
Constructor Details
-
FileHandler
public FileHandler()
-
-
Method Details
-
openConnection
Returns a connection to the a file pointed by thisURLin the file system- Specified by:
openConnectionin classURLStreamHandler- Parameters:
url- URL The URL to which the connection is pointing to- Returns:
- A connection to the resource pointed by this url.
- Throws:
IOException- if an I/O error occurs during opening the connection.
-
openConnection
The behavior of this method is the same as openConnection(URL).proxyis not used in FileURLConnection.- Overrides:
openConnectionin classURLStreamHandler- Parameters:
url- the URL which the connection is pointing toproxy- Proxy- Returns:
- a connection to the resource pointed by this url.
- Throws:
IOException- if this handler fails to establish a connection.IllegalArgumentException- if the url argument is null.UnsupportedOperationException- if the protocol handler doesn't support this method.
-
parseURL
Parse thestringstr intoURLu which already have the context properties. The string generally have the following format:./c:/windows/win.ini - Overrides:
parseURLin classURLStreamHandler- Parameters:
url- The URL object that's parsed intospec- The string equivalent of the specification URLstart- The index in the spec string from which to begin parsingend- The index to stop parsing- See Also:
URLStreamHandler.toExternalForm(URL),URL
-