|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
[Description] This interface defines the capabilities that a file connection must have.
Method Summary | |
long |
availableSize()
This method determines the free memory that is available on the file system the file or directory resides on Method/constructor extra info |
boolean |
canRead()
Checks if the file or directory is readable. |
boolean |
canWrite()
Checks if the file or directory is writeable. |
void |
create()
Creates a file corresponding to the file string provided in the Connector.open() method for this FileConnection. |
void |
delete()
Deletes the file or directory specified in the Connector.open() URL. |
long |
directorySize(boolean includeSubDirs)
Determines the size in bytes on a file system of all of the files that contained in a directory Method/constructor extra info |
boolean |
exists()
Checks if the file or directory specified in the URL passed to the Connector.open() method exists. |
long |
fileSize()
Determines the size of a file. |
String |
getName()
Returns the name of a file or directory excluding the URL schema and all paths. |
String |
getPath()
Returns the path excluding the file or directory name and the "file" URL schema and host from where the file or directory specified in the Connector.open() method is opened. getName() can be appended to this value to get a fully qualified path filename. |
String |
getURL()
Returns the full file URL including the scheme, host, and path from where the file or directory specified in the Connector.open() method is opened. |
boolean |
isDirectory()
Checks if the URL passed to the Connector.open() is a directory. |
boolean |
isHidden()
Checks if the file is hidden. |
boolean |
isOpen()
Checks if the file is hidden. |
long |
lastModified()
Returns the time that the file denoted by the URL specified in the Connector.open() method was last modified. |
Enumeration |
list()
Gets a list of all files and directories contained in a directory. |
Enumeration |
list(String filter,
boolean includeHidden)
Gets a filtered list of files and directories contained in a directory. |
void |
mkdir()
Creates a directory corresponding to the directory string provided in the Connector.open() method. |
DataInputStream |
openDataInputStream()
Open and return a data input stream for a connection. |
DataOutputStream |
openDataOutputStream()
Open and return a data output stream for a connection. |
InputStream |
openInputStream()
Open and return an input stream for a connection. |
OutputStream |
openOutputStream()
Open and return an output stream for a connection. |
OutputStream |
openOutputStream(long byteOffset)
opens an output stream and positions it at the indicated byte offset in the file. |
void |
rename(String newName)
Renames the selected file or directory to a new name in the same directory. |
void |
setFileConnection(String fileName)
Resets this FileConnection object to another file or directory. |
void |
setHidden(boolean hidden)
Sets the hidden attribute of the selected file to the value provided. |
void |
setReadable(boolean readable)
Sets the file or directory readable attribute to the indicated value. |
void |
setWritable(boolean writable)
Sets the selected file or directory writable attribute to the indicated value. |
long |
totalSize()
Determines the total size of the file system the connection's target resides on. |
void |
truncate(long byteOffset)
Truncates the file, discarding all data from the given byte offset to the current end of the file. |
long |
usedSize()
Determines the used memory of a file system the connection's target resides on. |
Methods inherited from interface javax.microedition.io.Connection |
close |
Method Detail |
public long availableSize()
return
- - long the available size in bytes on a file system.SecurityException
- - if the security of the application does
not have read access to the root volume.IllegalStateException
- - if the application does have read access
to the directory but has opened the connection
in Connector.WRITE mode.public boolean canRead()
return
- - true if the connection's target is readable otherwise false.
If the connection is closed, false is returned.SecurityException
- - if the security of the application does not
have read access for the connection's target.IllegalStateException
- - if the application does have read access
to the directory but has opened the connection
in Connector.WRITE mode.public boolean canWrite()
return
- - true if the connection's target is writeable otherwise false.
If the connection is closed, false is returned.SecurityException
- - if the security of the application does not
have read access for the connection's target.IllegalStateException
- - if the application does have read access
to the directory but has opened the connection
in Connector.WRITE mode.public void create() throws IOException
return
- - true if the file has been successfully created otherwise false.SecurityException
- - if the security of the application does not have
write access for the file.IllegalStateException
- - if the application does have write access
to the file but has opened the connection in
Connector.READ mode.IOException
- - if invoked on an existing file or on any directory
(mkdir() is used to create directories),
or the connection is closed.public void delete() throws IOException
return
- - true if the file has been successfully deleted otherwise false.SecurityException
- - if the security of the application does not have
write access for the file.IllegalStateException
- - if the application does have write access
to the file but has opened the connection in
Connector.READ mode.IOException
- - if the connection is closedpublic long directorySize(boolean includeSubDirs) throws IOException
return
- - long the size in bytes occupied by the files included in
the directory. If the connection is closed, the last known value is returned.inlcudeSubdirs
- - boolean if includes subdirctorysSecurityException
- - if the security of the application does not
have read access for the directory.IllegalStateException
- - if the security of the application does not
have read access for the directory.IOException
- - if the method is invoked on a file.public boolean exists()
return
- - true if the specified file/dir exists otherwise false.
If the connection is closed, the last known value is returnedSecurityException
- - if the security of the application does not
have read access for the connection's target.IllegalStateException
- - if the application does have read access
to the connection's target but has opened the
connection in Connector.WRITE mode.public long fileSize() throws IOException
return
- - long The size in bytes of the selected file. If the connection is
closed, the last known value is returned.IOException
- - if the method is invoked on a directory.SecurityException
- - if the security of the application does not have
read access for the file.IllegalStateException
- - if the application does have read access to
the file but has opened the connection in
Connector.WRITE mode.public String getName()
return
- - String Returns the name of a file or directory excluding the
URL schema and all paths.public String getPath()
return
- - String the path of a file or directorypublic String getURL()
return
- - String the path of a file or directorypublic boolean isDirectory()
return
- - boolean True if the specified URL is a directory otherwise false.
If the connection is closed, the last known value is returned.public boolean isHidden()
return
- - boolean true if the file is hidden otherwise false. If the
connection is closed, the last know value is returned.SecurityException
- - if the security of the application does not have
read access for the connection's target.IllegalStateException
- - if the application does have read access to
the connection's target but has opened the connection
in Connector.WRITE mode.public boolean isOpen()
return
- - boolean true if the file connection is open,otherwise false.public long lastModified()
return
- - long value representing the time the file was last modified,
or zero if an I/O error occurs.SecurityException
- - if the security of the application does not have
read access for the connection's target.IllegalStateException
- - if the application does have read access to
the connection's target but has opened the
connection in Connector.WRITE mode.public Enumeration list() throws IOException
return
- - Enumeration of strings, denoting the files and directories
in the directory.IOException
- - if the connection is closed, invoked on a file, or
an IO error occursSecurityException
- - if the security of the application does not have
read access for the directory.IllegalStateException
- - if the application does have read access
to the directory but has opened the connection
in Connector.WRITE mode.public Enumeration list(String filter, boolean includeHidden) throws IOException
return
- - Enumeration of strings, denoting the files and directories
in the directory.filter
- - String against which all files and directories are matched
for retrieval.includeHiden
- - booleanIOException
- - if the connection is closed, invoked on a file, or
an IO error occursSecurityException
- - if the security of the application does not have
read access for the directory.IllegalStateException
- - if the application does have read access
to the directory but has opened the connection
in Connector.WRITE mode.NullPointerException
- - if filter is nullpublic void mkdir() throws IOException
return
- - true if the directory has been successfully created otherwise falsefilter
- - String against which all files and directories are matched
for retrieval.includeHiden
- - booleanIOException
- - if invoked on an existing directory or on any file
(create() is used to create files), or the connection
is closedSecurityException
- - if the security of the application does not have
write access to the directoryIllegalStateException
- - if the application does have write access
to the directory but has opened the connection in
Connector.READ mode.public DataInputStream openDataInputStream() throws IOException
openDataInputStream
in interface InputConnection
return
- - An input streamIOException
- - If an I/O error occurs, if the method is invoked on
a directory, or if the application does have read
access to the connection's target but has opened
the connection in Connector.WRITE mode.SecurityException
- - If the application is not granted read access
to the connection's targetpublic DataOutputStream openDataOutputStream() throws IOException
openDataOutputStream
in interface OutputConnection
return
- - An output streamIOException
- - If an I/O error occurs, if the method is invoked on
a directory, or if the application does have write
access to the connection's target but has opened the
connection in Connector.READ mode.SecurityException
- - If the application is not granted write access
to the connection's target.public InputStream openInputStream() throws IOException
openInputStream
in interface InputConnection
return
- - An input streamIOException
- - If an I/O error occurs, if the method is invoked on
a directory, or if the application does have read
access to the connection's target but has opened the
connection in Connector.WRITE modeSecurityException
- - If the application is not granted read access
to the connection's targetpublic OutputStream openOutputStream() throws IOException
openOutputStream
in interface OutputConnection
return
- - An output streamIOException
- - If an I/O error occurs, if the method is invoked on
a directory, or if the application does have write
access to the connection's target but has opened the
connection in Connector.READ mode.SecurityException
- - If the application is not granted write access
to the connection's target.public OutputStream openOutputStream(long byteOffset) throws IOException
return
- - An output streambyteOffset
- - int number of bytes to skip over from the beginning of the
file when positioning the start of the OutputStream.IOException
- - If an I/O error occurs, if the method is invoked on
a directory, or if the application does have write
access to the connection's target but has opened the
connection in Connector.READ mode.IOException
- - if the method is invoked on a directorySecurityException
- - If the application is not granted write access
to the connection's target.IllegalArgumentException
- - if byteOffset has a negative valuepublic void rename(String newName) throws IOException
newName
- - String the new name of the file or directory..IOException
- - if the connection's target does not exist,
the connection is closed, or a file or directory
already exists by the newName.SecurityException
- - if the security of the application does not
have write access to the connection's target.IllegalArgumentException
- - if the application does have write
access to the connection's target but has opened
the connection in Connector.READ mode.NullPointerException
- - if newName is null.IllegalArgumentException
- - if newName contains any path
specification or is an invalild filename for the platform
(e.g. contains characters invalid in a filename on the platform).public void setFileConnection(String fileName) throws IOException
fileName
- - name of the file or directory to which this FileConnection
will be reset.NullPointerException
- - if fileName is null.IOException
- - if the current FileConnection is opened on a file.SecurityException
- - if the security of the application does not
have the security access to the specified file
or directory as requested in the Connector.open
method invocation that originally opened this FileConncetion.IllegalArgumentException
- - if newName contains any path
specification or is an invalild .NullPointerException
- - if newName is null.IllegalArgumentException
- - if newName contains any path
specification or is an invalild filename for the platformpublic void setHidden(boolean hidden) throws IOException
hidden
- - Boolean The new state of the hidden flag of the selected file.IOException
- - if the connection is closed.SecurityException
- - if the security of the application does not
have write access to the connection's targetIllegalStateException
- - if the application does have write access to
the connection's target but has opened the
connection in Connector.READ mode.public void setReadable(boolean readable) throws IOException
readable
- - The new state of the readable flag of the selected file.SecurityException
- - if the security of the application does not
have write access to the connection's target.IllegalStateException
- - if the application does have write access
to the connection's target but has opened the
connection in Connector.READ mode.IOException
- public void setWritable(boolean writable) throws IOException
writable
- - Boolean the new state of the writable flag of the selected file.SecurityException
- - if the security of the application does not have
write access to the connection's target.IllegalStateException
- - if the application does have write access
to the connection's target but has opened the
connection in Connector.READ mode.IOException
- public long totalSize()
Return
- - Long the total size of the file system in bytes.SecurityException
- - if the security of the application does not
have read access to the root volume.IllegalStateException
- - if the application does have read access
to the connection's target but has opened the
connection in Connector.WRITE mode.IOException
- public void truncate(long byteOffset) throws IOException
byteOffset
- - int offset into the file from which truncation will occurIOException
- - if invoked on a directory, the file does not exist,
or the connection is closed.SecurityException
- - if the security of the application does not have
write access to the fileIllegalStateException
- -if the application does have write access to
the file but has opened the connection in Connector.READ mode.IllegalArgumentException
- - if byteOffset is nullpublic long usedSize()
Return
- - Long The used size of bytes on a file system.SecurityException
- - if the security of the application does not
have read access to the root volume.IllegalStateException
- - if the application does have read access
to the connection's target but has opened the
connection in Connector.WRITE mode.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |