FileDocCategorySizeDatePackage
Handler.javaAPI DocAndroid 1.5 API3633Wed May 06 22:41:04 BST 2009org.apache.harmony.luni.internal.net.www.protocol.file

Handler

public class Handler extends URLStreamHandler
This is the handler that is responsible for reading files from the file system.

Fields Summary
Constructors Summary
Methods Summary
public java.net.URLConnectionopenConnection(java.net.URL url)
Returns a connection to the a file pointed by this URL in the file system

return
A connection to the resource pointed by this url.
param
url URL The URL to which the connection is pointing to

        return new FileURLConnection(url);
    
public java.net.URLConnectionopenConnection(java.net.URL url, java.net.Proxy proxy)
The behaviour of this method is the same as openConnection(URL). proxy is not used in FileURLConnection.

param
u the URL which the connection is pointing to
param
proxy Proxy
return
a connection to the resource pointed by this url.
throws
IOException if this handler fails to establish a connection.
throws
IllegalArgumentException if any argument is null or of an invalid type.
throws
UnsupportedOperationException if the protocol handler doesn't support this method.

        if (null == url || null == proxy) {
            // K034b=url and proxy can not be null
            throw new IllegalArgumentException(Msg.getString("K034b")); //$NON-NLS-1$
        }
        return new FileURLConnection(url);
    
protected voidparseURL(java.net.URL u, java.lang.String str, int start, int end)
Parse the stringstr into URL u which already have the context properties. The string generally have the following format:
/c:/windows/win.ini
.

param
u The URL object that's parsed into
param
str The string equivalent of the specification URL
param
start The index in the spec string from which to begin parsing
param
end The index to stop parsing
see
java.net.URLStreamHandler#toExternalForm(URL)
see
java.net.URL

        if (end < start) {
            return;
        }
        String parseString = ""; //$NON-NLS-1$
        if (start < end) {
            parseString = str.substring(start, end).replace('\\", '/");
        }
        super.parseURL(u, parseString, 0, parseString.length());