|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcontrol.storage.FlashStream
public class FlashStream
This class FlashStream
represents a memory cached
data stream for reading and writing continuous data to the flash memory.
If the flash memory is full or some other error
occurs, an IOException
is thrown.
Flash
,
FlashTlv
lib |
Field Summary | |
---|---|
protected byte[] |
cache
sector cache for faster reads |
protected byte |
m_bank
currently used flash bank (always starts at bank 0) |
protected int |
m_pos
position in current sector (for the stream) |
protected int |
m_sector
current sector |
protected int |
sectorcount
flash sectorsize and -count |
protected int |
sectorsize
flash sectorsize and -count |
Constructor Summary | |
---|---|
FlashStream()
Create a new flash stream. |
Method Summary | |
---|---|
void |
clearCache()
Frees the flash memory. |
void |
close()
Closes the stream, further reads are not possible, attached hardware will be turned off. |
int |
getSectorsize()
Returns the sectorsize. |
char |
read()
Read a single character from the flash stream. |
int |
read(byte[] buffer,
int startindex,
int length)
Read data from the flash stream. |
int |
write(byte[] buffer,
int startindex,
int length)
Write data to the flash stream. |
void |
write(char data)
Write a single character to the flash stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, notifyAll, wait |
Field Detail |
---|
protected byte[] cache
protected byte m_bank
protected int m_pos
protected int m_sector
protected int sectorcount
protected int sectorsize
Constructor Detail |
---|
public FlashStream() throws IOException
IOException
Method Detail |
---|
public void clearCache()
public void close()
BasicInputStream
finalize
of implementing classes.
close
in interface BasicInputStream
close
in interface BasicOutputStream
BasicOutputStream.close()
public int getSectorsize()
public char read() throws IOException
read
in interface BasicInputStream
IOException
- if an error occursBasicInputStream.read()
public int read(byte[] buffer, int startindex, int length) throws IOException
read
in interface BasicInputStream
buffer
- the buffer to fillstartindex
- the index to start filling the arraylength
- number of byte to read; the array is filled from startindex
to
startindex
+length
-1
IOException
- if an error occursBasicInputStream.read(byte[], int, int)
public int write(byte[] buffer, int startindex, int length) throws IOException
Write data to the flash stream.
write
in interface BasicOutputStream
buffer
- the buffer that holds the data to writestartindex
- the index to start reading the arraylength
- number of bytes to write; the array is read from startindex
to
startindex
+length
-1
IOException
- if an error occursBasicOutputStream.write(byte[], int, int)
public void write(char data) throws IOException
Write a single character to the flash stream.
write
in interface BasicOutputStream
data
- the byte to write (range of the char 0 .. 255, the highbyte is ignored)
IOException
- if an error occursBasicOutputStream.write(char)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |