The list below contains additional notes:
Escaped and unescaped URI forms are accepted as input unless stated otherwise. The output full or partial URI is unescaped unless stated otherwise. The methods that take a full or partial URI:
Connector.open("file://...")
FileConnection.setFileConnection(String fileName)
FileConnection.rename(String newName)
Connector.open
accepts both forms. The FileConnection.setFileConnection()
operation
does not unescape URIs because the argument must be one of the values returned
by the FileConnection.list()
operation, which returns
unescaped forms. This means that FileConnection.setFileConnection()
can
be used to open files with names that contain special characters such as "My%20Doc.txt".
Nothing is specified for the FileConnection.rename()
operation,
so it must accept both forms. The methods that return a full or partial URL
(one or more):
String FileConnection.getName()
String FileConnection.getPath()
String FileConnection.getURL()
java.util.Enumeration FileConnection.list()
java.util.Enumeration FileConnection.list(String
filter, boolean includeHidden)
Of these getName()
and getPath()
operations
return unescaped forms, but the getURL()
operation returns
the escaped form, as specified. Since nothing is stated for the list()
methods,
they return unescaped forms.
READ_WRITE and WRITE connections can be established to the
read-only file and directory. This is needed because otherwise changing the
file/directory to writable is not possible through a File API interface since
the setWritable()
operation needs either a READ_WRITE
or WRITE connection mode. The following methods can be called in the "write
mode to read-only file" mode: setWritable()
and setHidden()
. IOException
is
thrown if other methods, which need a WRITE connection mode, are called in
the "write mode to read-only file" mode. Note: setHidden()
and setWritable()
operations
close automatically an open InputStream
.
File API accepts only “localhost” or “” as a host in the
file URI. That is, valid URIs start with file://localhost/
or file:///
.
“/” character at the end of the URI is not mandatory if a
connection has been established to the directory. In case of an existing file/dir,
the implementation first searches whether a file by that name exists and after
that it searches for a directory by that name. In case of a new file/dir,
the user defines by calling create()
or mkdir()
operations
whether a file or a directory is created. Note: If URI ends to the “/” character
then calling create()
operation causes IOException
.