|
IM Profile | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.siemens.icm.io.File
The File class holds basic methods for accessing files on the MMC file system.
The first time you run this class method, a storage subfolder in the
application folder is created. In the current API version, there is no way to
create subfolders, so all files are placed in the storage folder if the
given path is relative to the application folder. Futhermore, ".." and "." is
forbidden in relative path which means that all path must be relative to the
application folder (which accesses the storage subfolder) or absolute to
the file system root (which accesses the file as given in the path).
Please consider that currently a maximum number of 10 files can be opened at
the same time. This concerns the open() as well as the debugWrite() function.
Please consider also that additional to all ASCII characters below 32 the following
characters are not allowed in file names:
: / \ * ? | < > "
The copy protection for JAR files avoid external reading, copying, moving or renaming of this kind of files.
Field Summary | |
static int |
INSIDE_STORAGE_PATH
Deprecated. |
static int |
OUTSIDE_STORAGE_PATH
Deprecated. |
Constructor Summary | |
File()
Deprecated. |
Method Summary | |
void |
close()
Deprecated. Closes the file. |
static void |
copy(String source,
String dest)
Deprecated. Performs a file copy. |
static void |
debugWrite(String fileName,
String infoString)
Deprecated. Writes a given string at the end of the file specified by the file name. |
static void |
delete(String fileName)
Deprecated. Deletes the file specified by its file name from the storage directory. |
static boolean |
exists(String fileName)
Deprecated. Checks if the file specified by the file name does exist. |
static char |
getAttributes(String fileName)
Deprecated. Returns the attribute byte of a file or folder. |
static boolean |
getCanRead(String fileName)
Deprecated. Returns the RO bit of the attribute byte of a file or folder. |
static boolean |
getCanWrite(String fileName)
Deprecated. Returns the complement of the RO bit of the attribute byte of a file or folder. |
static long |
getDirectorySize(String directoryName)
Deprecated. Returns the size of a folder. |
static boolean |
getIsHidden(String fileName)
Deprecated. Returns the Hidden bit of the attribute byte of a file or folder. |
static long |
getLastModified(String fileName)
Deprecated. Returns the time in seconds since last modification of the file or directory. |
static long |
getTotalSize(String fileName)
Deprecated. Returns the total size of a drive. |
static boolean |
isDirectory(String pathName)
Deprecated. Checks if the given path specifies a directory. |
boolean |
isOpen()
Deprecated. Return the open state of the file corresponding to the class instance. |
int |
length()
Deprecated. Returns the file length, in bytes. |
static String[] |
list(String pathName)
Deprecated. Lists the content of a directory. |
static String[] |
list(String pathName,
boolean includeHidden)
Deprecated. Lists the content of a directory. |
static boolean |
mkdir(String dirName)
Deprecated. Creates a directory. |
void |
open(String fileName)
Deprecated. Opens the file specified by the file name and prepares it for reading and writing. |
int |
read(byte[] buf,
int offset,
int numBytes)
Deprecated. Reads a maximum of numBytes bytes into a buffer from a file. |
static void |
rename(String source,
String dest)
Deprecated. Renames a file from source filename to destination filename. |
int |
seek(int seekpos)
Deprecated. Moves the file pointer to the specified location. |
static void |
setHidden(String fileName,
boolean hidden)
Deprecated. Sets/resets the Hidden bit of the attribute byte of a file or folder. |
static void |
setReadable(String fileName,
boolean readable)
Deprecated. Sets/resets the RO bit of the attribute byte of a file or folder. |
static void |
setWriteable(String fileName,
boolean readable)
Deprecated. Resets/sets the RO bit of the attribute byte of a file or folder. |
static int |
spaceAvailable()
Deprecated. Returns the free disk space (in bytes), available on the MMC file system. |
void |
truncate(int byteOffset)
Deprecated. Truncates the file at offset. |
void |
truncateFile(int byteOffset)
Deprecated. Truncates the file at offset. |
int |
write(byte[] buf,
int offset,
int numBytes)
Deprecated. Writes numBytes bytes from buffer to a file. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int OUTSIDE_STORAGE_PATH
public static final int INSIDE_STORAGE_PATH
Constructor Detail |
public File()
Method Detail |
public static void debugWrite(String fileName, String infoString) throws IOException
fileName
- the name of the file to write toinfoString
- the string that will be written to the file
IOException
- if some kind of I/O error occurspublic void open(String fileName) throws IOException
fileName
- the name of the file to be opened
IllegalArgumentException
- if the path is invalid
IOException
- if the file is already open or some other kind of I/O error occurspublic static boolean exists(String fileName) throws IOException
fileName
- the name of the file
IllegalArgumentException
- if the given path is invalid
IOException
- if some internal kind of I/O error occurscopy
,
rename
,
delete
public int seek(int seekpos) throws IOException
seekpos
- position to set the file pointer to i.e. the number of bytes
from the beginning of the file
IOException
- if the file isn't open or some other kind of I/O error occursopen
,
read
,
write
public int length() throws IOException
IOException
- if the file isn't open or some other kind of I/O error occursopen
public void close() throws IOException
IOException
- if the file isn't open or some other kind of I/O error occursopen
public int write(byte[] buf, int offset, int numBytes) throws IOException
buf
- the bytearray with data to be writtenoffset
- offset of the data to be written within the bytearraynumBytes
- number of bytes to be written
IOException
- if the file isn't open or some other kind of I/O error occursopen
,
read
,
seek
public int read(byte[] buf, int offset, int numBytes) throws IOException
buf
- the buffer for the data to be readoffset
- offset within the buffer for data to be readnumBytes
- number of bytes to read
IOException
- if the file isn't open or some other kind of I/O error occursopen
,
write
,
seek
public static void delete(String fileName) throws IOException
fileName
- name of the file to be deleted
IllegalArgumentException
- if the path is invalid
IOException
- if the file doesn't exist or some other kind of I/O error occursexists
,
copy
,
rename
public static boolean mkdir(String dirName) throws IOException
dirName
- name of the directory to be created
IOException
- if an I/O error occurspublic static char getAttributes(String fileName) throws IOException
fileName
- path and name to directory or file
IOException
- if the file or directory doesn't exist or some other kind of I/O error occurssetReadable
,
setWriteable
,
setHidden
,
getIsHidden
,
getCanWrite
,
getCanRead
public static void setReadable(String fileName, boolean readable) throws IOException
fileName
- path and name to directory or file
IOException
- if the file or directory doesn't exist or some other kind of I/O error occursgetAttributes
,
setWriteable
,
setHidden
,
getIsHidden
,
getCanWrite
,
getCanRead
public static void setWriteable(String fileName, boolean readable) throws IOException
fileName
- path and name to directory or file
IOException
- if the file or directory doesn't exist or some other kind of I/O error occursgetAttributes
,
setReadable
,
setHidden
,
getIsHidden
,
getCanWrite
,
getCanRead
public static void setHidden(String fileName, boolean hidden) throws IOException
fileName
- path and name to directory or filehidden
- value
IOException
- if the file or directory doesn't exist or some other kind of I/O error occursgetAttributes
,
setReadable
,
setWriteable
,
getIsHidden
,
getCanWrite
,
getCanRead
public static long getDirectorySize(String directoryName) throws IOException
IOException
- if the directory doesn't exist or some other kind of I/O error occurspublic static long getTotalSize(String fileName) throws IOException
fileName
- drive name
IOException
- if an I/O error occurspublic void truncate(int byteOffset) throws IOException
byteOffset
- offset in bytes
IOException
- if an I/O error occurspublic void truncateFile(int byteOffset) throws IOException
byteOffset
- offset in bytes
IOException
- if an I/O error occurspublic static boolean getIsHidden(String fileName) throws IOException
fileName
- path and name to directory or file
IOException
- if the file or directory doesn't exist or some other kind of I/O error occursgetAttributes
,
setReadable
,
setWriteable
,
setHidden
,
getCanWrite
,
getCanRead
public static boolean getCanWrite(String fileName) throws IOException
fileName
- path and name to directory or file
IOException
- if the file or directory doesn't exist or some other kind of I/O error occursgetAttributes
,
setReadable
,
setWriteable
,
setHidden
,
getIsHidden
,
getCanRead
public static boolean getCanRead(String fileName) throws IOException
fileName
- path and name to directory or file
IOException
- if the file or directory doesn't exist or some other kind of I/O error occursgetAttributes
,
setReadable
,
setWriteable
,
setHidden
,
getIsHidden
,
getCanWrite
public static long getLastModified(String fileName) throws IOException
fileName
- path and name to directory or file
IOException
- if the directory doesn't exist or some other kind of I/O error occurspublic static int spaceAvailable() throws IOException
IOException
- if some kind of I/O error occurspublic static void rename(String source, String dest) throws IOException
source
- source name of the filedest
- destination name of the file
IllegalArgumentException
- if the path is invalid
IOException
- if some kind of I/O error occursexists
,
copy
,
delete
public static void copy(String source, String dest) throws IOException
source
- name of the source filedest
- name of the destination file (the file copy)
IllegalArgumentException
- if the path of one of the arguments is invalid
IOException
- if some kind of I/O error occursexists
,
rename
,
delete
public static boolean isDirectory(String pathName) throws IOException
pathName
- the name of the path to be checked
IllegalArgumentException
- if the path is invalid
IOException
- if the given path doesn't exist or some other kind of I/O error occursopen
,
copy
,
rename
,
delete
public static String[] list(String pathName) throws IOException
pathName
- path to directory to be listed
IllegalArgumentException
- if the path is invalid
IOException
- if the directory doesn't exist or some other kind of I/O error occurs
or the number of directory entries exceeds 200.open
,
copy
,
rename
,
delete
public static String[] list(String pathName, boolean includeHidden) throws IOException
pathName
- path to directory to be listedincludeHidden
- includes hidden files and directories
IllegalArgumentException
- if the path is invalid
IOException
- if the directory doesn't exist or some other kind of I/O error occurs
or the number of directory entries exceeds 200.open
,
copy
,
rename
,
delete
public boolean isOpen()
|
IM Profile | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |