|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeer2me.util.FileHandler
This class contains functionality for reading and writing all kinds of files to and from the device file system.
Constructor Summary | |
FileHandler(java.lang.String filePath)
Constructor. |
Method Summary | |
void |
closeFile()
This method closes and nullifies the input- and ouput streams, and the file connection |
int |
getBlockSize()
This method fetches the size of the blocks to read and write |
java.util.Enumeration |
getFileList()
This method returns a list of the files in the given file path on the device |
long |
getFileSize()
This method returns the size of the this file |
byte[] |
readFile()
This method reads the next byte in the file and returns it |
void |
setFileSize(long fileSize)
This method sets the size of the this file |
void |
writeFile(byte theByte)
Deprecated. The method is substituted by writeFile(byte[] theBytes, int numberOfBytesRead) |
void |
writeFile(byte[] theBytes,
int numberOfBytesRead)
This method writes the incoming byte block to the file |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileHandler(java.lang.String filePath)
filePath
- The path to the file to be handledMethod Detail |
public java.util.Enumeration getFileList()
public long getFileSize()
public int getBlockSize()
public void setFileSize(long fileSize)
fileSize
- The size to setpublic byte[] readFile() throws java.io.IOException
java.io.IOException
- This exception is thrown when the reading has failedpublic void writeFile(byte[] theBytes, int numberOfBytesRead) throws java.io.IOException
theBytes
- The next byte block to writenumberOfBytesRead
- The number of bytes in the theBytes[] array
java.io.IOException
- This exception is thrown when the writing has failedpublic void writeFile(byte theByte) throws java.io.IOException
theByte
- The next byte to write
java.io.IOException
- This exception is thrown when the writing has failedpublic void closeFile()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |