Methods Summary |
---|
public long | availableSize()Determines the free memory that is available on the file system the file
or directory resides on. This may only be an estimate and may vary based
on platform-specific file system blocking and metadata information.
|
public boolean | canRead()Check if file corresponding to this filehandler exists and has a
read permission.
|
public boolean | canWrite()Check is file corresponding to this filehandler exists and has a
write permission.
|
public void | close()Close file associated with this handler. Open file and all system
resources should be released by this call. Handler object can be
reused by subsequent call to connect().
|
public void | closeForRead()Closes for reading the file that was open by openForRead method.
If the file is already closed for reading this method does nothing.
|
public void | closeForReadWrite()Closes the file for both reading and writing.
If the file is already closed for reading and writing this method does
nothing.
|
public void | closeForWrite()Closes for writing the file that was open by openForWrite method.
If the file is already closed for writing this method does nothing.
|
public void | connect(java.lang.String rootName, java.lang.String absFile)Connect file handler to the abstract file target. This operation should
not trigger any access to the native filesystem.
|
public void | create()Create file corresponding to this file handler. The
file is created immediately on the actual file system upon invocation of
this method. Files are created with zero length and data can be put
into the file through write method after opening the file.This method
does not create any directories specified in the file's path.
|
public void | createPrivateDir(java.lang.String rootName)Creates dedicated private working directory for the MIDlet suite.
Does nothing if specified root is not private root or the directory
already exists.
|
public void | delete()Deletes the file or directory associated with this handler.
The file or directory is deleted immediately on
the actual file system upon invocation of this method. Previously open
native file should be closed.The
handler instance object remains connected and available for use.
|
public long | directorySize(boolean includeSubDirs)Determines the size in bytes on a file system of all of the files
that are contained in a directory.
|
public boolean | exists()Check is file or directory corresponding to this filehandler exists.
|
public long | fileSize()Determines the size of a file on the file system. The size of a file
always represents the number of bytes contained in the file; there is
no pre-allocated but empty space in a file. Users should perform an
explicit flush() on any open output streams to the file
prior to invoking this method to ensure accurate results.
|
public void | flush()Forces any buffered output bytes to be written out.
The general contract of flush is
that calling it is an indication that, if any bytes previously
written that have been buffered by the connection,
should immediately be written to their intended destination.
The flush method of ConnectionBaseAdapter
does nothing.
|
public java.lang.String | illegalFileNameChars()Returns a string that contains all characters forbidden for the use on
the given platform except "/" (forward slash) which is always considered
illegal. If there are no such characters an empty string is returned.
|
public boolean | isDirectory()Check is file corresponding to this filehandler exists and is a
directory.
|
public boolean | isHidden()Check is file corresponding to this filehandler exists and is
hidden.
|
public long | lastModified()Returns the time that the file denoted by this file handler
was last modified.
|
public java.util.Vector | list(java.lang.String filter, boolean includeHidden)Gets a filtered list of files and directories contained in a directory.
The directory is the handler's target as specified in
create() .
|
public java.util.Vector | listRoots()List filesystem roots available on the device. For the description of
the correct root format see FileConnection documentation.
|
public void | mkdir()Creates a directory corresponding to the directory
string provided in the connect() method.
The directory is created immediately on the actual
file system upon invocation of this method. Directories in the
specified path are not recursively created and must be explicitly
created before subdirectories can be created.
|
public void | openForRead()Open the file for reading, on the underlying file system. File name is
passed in the link#connect() method.
|
public void | openForWrite()Open the file for writing, on the underlying file system. File name is
passed in the link#connect() method.
|
public void | positionForWrite(long offset)Sets the location for the next write operation.
|
public int | read(byte[] b, int off, int len)Reads up to len bytes of data from the input stream into
an array of bytes, blocks until at least one byte is available.
|
public void | rename(java.lang.String newName)Renames the selected file or directory to a new name in the same
directory. The file or directory is renamed immediately on the actual
file system upon invocation of this method. No file or directory by the
original name exists after this method call. Previously open native file
should be closed. The handler
instance object remains connected and available for use,
referring now to the file or directory by its new name.
|
public void | setHidden(boolean hidden)Sets the hidden attribute of the file associated with this file handler
to the value provided. The attribute is applied to the file on the
actual file system immediately upon invocation of this method if the
file system
and platform support it. If the file system doesn't support a hidden
attribute, this method is ignored and isHidden() always
returns false. Since the exact definition of hidden is
system-dependent,
this method only works on file systems that support a settable file
attribute. For example, on Win32 and FAT file systems, a file may be
considered hidden if it has been marked as such in the file's
attributes; therefore this method is applicable. However on UNIX
systems a file may be considered to be hidden if its name begins with a
period character ('.'). In the UNIX case, this method may be ignored and
the method to make a file hidden may be the rename()
method.
|
public void | setReadable(boolean readable)Sets the file or directory readable attribute to the
indicated value. The readable attribute for the file on the actual
file system is set immediately upon invocation of this method. If the
file system doesn't support a settable read attribute, this method is
ignored and canRead() always returns true.
|
public void | setWritable(boolean writable)Sets the file or directory associated with this file handler writable
attribute to the
indicated value. The writable attribute for the file on the actual
file system is set immediately upon invocation of the method. If the
file system doesn't support a settable write attribute, this method is
ignored and canWrite() always returns true.
|
public long | totalSize()Determines the total size of the file system the connection's target
resides on.
|
public void | truncate(long byteOffset)Truncates the file, discarding all data from the given byte offset to
the current end of the file. If the byte offset provided is greater
than or equal to the file's current byte count, the method returns
without changing the file.
|
public long | usedSize()Determines the used memory of a file system the connection's target
resides on. This may only be an estimate and may vary based
on platform-specific file system blocking and metadata information.
|
public int | write(byte[] b, int off, int len)Writes len bytes from the specified byte array
starting at offset off to this output stream.
Polling the native code is done here to allow for simple
asynchronous native code to be written. Not all implementations
work this way (they block in the native code) but the same
Java code works for both.
|