net.rim.device.api.io
Class File

java.lang.Object
  extended by net.rim.device.api.io.File

public final class File
extends Object

Provides low-level access to various file systems. This class provides acces to only the iDEN file system. To access file systems such as the device store or SDCard use the javax.microedition.io.file classes.

See Also:
FileConnection
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

Field Summary
Category: Signed static int FILESYSTEM_PATRIOT
          File system built into iDEN devices.
 
Method Summary
Category: Signed static void delete(int fs, String fileName)
          Deletes the specified file.
Category: Signed static String findFirst(int fs, String pattern)
          Finds the first file that matches the specified pattern.
Category: Signed static boolean findFirst(int fs, String pattern, FileInfo fileInfo)
          Finds the first file that matches the specified pattern.
Category: Signed static String findNext(int fs)
          Finds the next file that matches the specified pattern.
Category: Signed static boolean findNext(int fs, FileInfo fileInfo)
          Finds the next file that matches the specified pattern.
Category: Signed static long getFileSize(int fs, String fileName)
          Retrieves the size of the specified file.
Category: Signed static long getFileSystemFreeSpace(int fs)
          Retrieves the free space for the specified file system.
Category: Signed static long getFileSystemTotalSpace(int fs)
          Retrieves the total size for the specified file system.
Category: Signed static boolean isFileSystemSupported(int fs)
          Determines if this device supports the specified file system.
Category: Signed static boolean isSupported()
          Determines if this device supports one or more file systems.
Category: Signed static void rename(int fs, String oldFileName, String newFileName)
          Renames the specified file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

FILESYSTEM_PATRIOT

public static final int FILESYSTEM_PATRIOT
File system built into iDEN devices.

See Also:
Constant Field Values
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2


Method Detail

isSupported

public static final boolean isSupported()
Determines if this device supports one or more file systems.

Returns:
True if this device provides access to one or more file systems.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

isFileSystemSupported

public static final boolean isFileSystemSupported(int fs)
Determines if this device supports the specified file system.

Parameters:
fs - One of the FILESYSTEM_ values.
Returns:
True if this device provides access to the specified file system.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

delete

public static void delete(int fs,
                          String fileName)
                   throws IOException
Deletes the specified file.

Parameters:
fs - One of the FILESYSTEM_ values.
fileName - The name of the file.
Throws:
IOException - if a file with the specified name does not exist on the specified filesystem.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

rename

public static void rename(int fs,
                          String oldFileName,
                          String newFileName)
                   throws IOException
Renames the specified file.

Parameters:
fs - One of the FILESYSTEM_ values.
oldFileName - The name of the file.
newFileName - The new name for the file.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

getFileSystemTotalSpace

public static long getFileSystemTotalSpace(int fs)
                                    throws IOException
Retrieves the total size for the specified file system.

Parameters:
fs - One of the FILESYSTEM_ values.
Returns:
The total number of bytes in the file system.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

getFileSystemFreeSpace

public static long getFileSystemFreeSpace(int fs)
                                   throws IOException
Retrieves the free space for the specified file system.

Parameters:
fs - One of the FILESYSTEM_ values.
Returns:
The number of available bytes in the file system.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

getFileSize

public static long getFileSize(int fs,
                               String fileName)
                        throws IOException
Retrieves the size of the specified file.

Note: Calling this method resets any findFirst or findNext query in progress.

Parameters:
fs - One of the FILESYSTEM_ values.
fileName - The name of the file.
Returns:
The size of the file in bytes.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

findFirst

public static String findFirst(int fs,
                               String pattern)
                        throws IOException
Finds the first file that matches the specified pattern.

Parameters:
fs - One of the FILESYSTEM_ values.
pattern - A pattern to search within file names. This pattern can include wildcard characters (*).
Returns:
The file name of the first file that matches the pattern specified, or null if no file matches.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

findFirst

public static boolean findFirst(int fs,
                                String pattern,
                                FileInfo fileInfo)
                         throws IOException
Finds the first file that matches the specified pattern.

Parameters:
fs - One of the FILESYSTEM_ values.
pattern - A pattern to search within file names. This pattern can include wildcard characters (*).
fileInfo - A FileInfo instance to receive the file information.
Returns:
True if a file was found that matches the pattern specifed; false otherwise.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

findNext

public static String findNext(int fs)
                       throws IOException
Finds the next file that matches the specified pattern.

Parameters:
fs - One of the FILESYSTEM_ values.
Returns:
The next file that matches the pattern specified in a previous call to findFirst, or null if there are no more matches.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

findNext

public static boolean findNext(int fs,
                               FileInfo fileInfo)
                        throws IOException
Finds the next file that matches the specified pattern.

Parameters:
fs - One of the FILESYSTEM_ values.
fileInfo - A FileInfo instance to receive the file information.
Returns:
True if a file was found matching the pattern specifed; false otherwise.
Throws:
IOException
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.