|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcontrol.storage.FlashTlv
This class FlashTlv.class
implements a tag-length-value file system.
Each file(-type) is represented by a tag of 8 bits. Different files of the same
type may be stored. Use this for storing many small records in non-volatile flash memory.
Currently under development.
Flash
lib |
Field Summary | |
static int |
ALL
To specify all available memory with format(int) . |
Constructor Summary | |
FlashTlv(int flashBank)
Creates a new FlashTlv object. |
Method Summary | |
void |
cleanup()
This method will delete all obsolete data. |
void |
close()
Closes the current file for writing and reading. |
void |
create(byte tag)
Creates a new file object. |
void |
delete()
Marks the current file as obsolete. |
TlvFile |
findNext(TlvFile file)
Finds the next file. |
TlvFile |
findNext(TlvFile file,
byte tag)
Finds the next file with the specified tag. |
void |
format(int size)
Formats the available flash. |
boolean |
isFormated()
Checks if the the flash is prepared for the FlashTlv. |
boolean |
open(TlvFile file)
Opens the specified file for reading. |
byte[] |
read()
Returns the data of the current file. |
boolean |
write(byte[] newdata)
Writes data to the specified file. |
Methods inherited from class java.lang.Object |
clone, equals, notifyAll, wait |
Field Detail |
public static final int ALL
format(int)
.
Constructor Detail |
public FlashTlv(int flashBank) throws java.io.IOException
flashBank
- the flash bank to store the FlashTlv data in.
java.io.IOException
- if the flash couldn't be initialized.Method Detail |
public void cleanup() throws java.io.IOException
jcontrol.io.BadFormatException
- if the flash was not formatted correctly.
java.io.IOException
- if the flash couldn't be initialized.public void close() throws java.io.IOException
java.io.IOException
- if the flash couldn't be initialized.public void create(byte tag) throws java.io.IOException
tag
- The tag of the new file.
java.io.IOException
- if the flash couldn't be initialized or if the new file position is beyond the FlashTlv end-tag.public void delete() throws java.io.IOException
cleanup()
is called.
jcontrol.io.BadFormatException
- if the flash was not formatted correctly.
java.io.IOException
- if the flash couldn't be initialized.cleanup()
public TlvFile findNext(TlvFile file) throws java.io.IOException
file
- The file where the search will start.
If this parameter is null
, the search will start at the beginning.
jcontrol.io.BadFormatException
- if the flash was not formatted correctly.
java.io.IOException
- if the flash couldn't be initialized.public TlvFile findNext(TlvFile file, byte tag) throws java.io.IOException
file
- The file where the search will start.
If this parameter is null
, the search will start at the beginning.tag
- The tag to search for.
jcontrol.io.BadFormatException
- if the flash was not formatted correctly.
java.io.IOException
- if the flash couldn't be initialized.public void format(int size) throws java.io.IOException
size
- maximum FlashTlv size or ALL
if all space may be used.
java.io.IOException
- if the flash couldn't be initialized.public boolean isFormated() throws java.io.IOException
java.io.IOException
- if the flash couldn't be initialized.public boolean open(TlvFile file) throws java.io.IOException
file
- The file to read.
java.io.IOException
- if the flash couldn't be initialized.public byte[] read() throws java.io.IOException
jcontrol.io.BadFormatException
- if the flash was not formatted correctly.
java.io.IOException
- if the flash couldn't be initialized.public boolean write(byte[] newdata) throws java.io.IOException
newdata
- the data.
jcontrol.io.BadFormatException
- if the flash was not formatted correctly.
java.io.IOException
- if the flash couldn't be initialized.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |