nsIFileProtocolHandler
From MDC
The nsIFileProtocolHandler interface provides methods to convert between nsIFile and nsIURI. It also provides access to internet shortcuts stored on the host OS file system.
Contents |
nsIFileProtocolHandler is defined in netwerk/protocol/file/public/nsIFileProtocolHandler.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.8).
Inherits from: nsIProtocolHandler
[edit] Method overview
nsIURI newFileURI(in nsIFile aFile);
|
AUTF8String getURLSpecFromFile( in nsIFile file )
|
nsIFile getFileFromURLSpec(in AUTF8String url);
|
nsIURI readURLFile(in nsIFile file);
|
[edit] Methods
[edit] newFileURI()
This method constructs a new file URI.
nsIURI newFileURI(in nsIFile aFile);
[edit] Parameters
- aFile
- The
nsIFileto convert.
[edit] Return
- A reference to a new
nsIURIobject.
[edit] getURLSpecFromFile()
Converts the nsIFile to the corresponding URL string. If the nsIFile is a local file, then the result will be a file:// URL string. The resulting string may contain URL-escaped characters.
AUTF8String getURLSpecFromFile(in nsIFile file);
[edit] Parameters
- file
- The
nsIFileto convert.
[edit] Return
- Corresponding url string. The resulting string may contain URL-escaped characters.
[edit] getFileFromURLSpec()
Converts the URL string into the corresponding nsIFile if possible. A local file will be created if the URL string begins with file://.
nsIFile getFileFromURLSpec(in AUTF8String url);
[edit] Parameters
- url
- The url string to convert.
[edit] Return
- A reference to a new
nsIFileobject.
[edit] readURLFile()
Takes a local file and tries to interpret it as an internet shortcut (e.g. .url files on windows).
nsIURI readURLFile(in nsIFile file);
[edit] Parameters
- file
- The
nsIFileto read.
[edit] Return
- The
nsIURIthe file refers to
[edit] Exceptions thrown
NS_ERROR_NOT_AVAILABLE- The OS does not support such files.
NS_ERROR_NOT_AVAILABLE- The file is not an internet shortcut.