|
SunSPOT host API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.sun.spot.flashmanagement.FlashFileOutputStream
public class FlashFileOutputStream
FlashFileOutputStream represents an output stream over some flash memory. There are two uses for this.
The first is to stream over the flash memory allocated to an instance of a FlashFile
.
In this case, you should construct the output stream accordingly, for example:
In this case, the output stream will throw an IOException if you attempt to write beyond the end of the last sector allocated to the FlashFile. Note that this will allow more than requiredSize bytes to be written to the file when requiredSize is not equal to a whole number of flash memory sectors.FlashFile myFile = new FlashFile("my file"); myFile.createNewFile(requiredSize); FlashFileOutputStream ffos = new FlashFileOutputStream(myFile);
In this case, the output stream will throw an IOException if you attempt to write beyond the end of the sector.FlashFileOutputStream ffos = new FlashFileOutputStream(new NorFlashSector(mySectorNumber));
Field Summary | |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default size of the output buffer. |
Constructor Summary | |
---|---|
FlashFileOutputStream(FlashFile file)
Construct an output stream over the space allocated to a previously created FlashFile |
|
FlashFileOutputStream(FlashFile file,
int bufferSize)
Construct an output stream over the space allocated to a previously created FlashFile, specifying a non-standard buffer size. |
|
FlashFileOutputStream(IAddressableNorFlashSector sector)
Construct an output stream over a sector of the flash memory. |
Method Summary | |
---|---|
void |
close()
|
void |
flush()
|
void |
write(int b)
|
Methods inherited from class java.io.OutputStream |
---|
write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
Constructor Detail |
---|
public FlashFileOutputStream(FlashFile file) throws FlashFileNotFoundException
file
- The FlashFile to write data to
FlashFileNotFoundException
public FlashFileOutputStream(FlashFile file, int bufferSize) throws FlashFileNotFoundException
flush()
or close()
are called. Thus varying the buffer size affects the performance characteristics of the
output stream. The default value is 512;
file
- The FlashFile to write data tobufferSize
- The size - in bytes - for the FlashFile's output buffer.
FlashFileNotFoundException
public FlashFileOutputStream(IAddressableNorFlashSector sector) throws FlashFileNotFoundException
sector
- the sector to write data to.
FlashFileNotFoundException
Method Detail |
---|
public void write(int b) throws IOException
write
in class OutputStream
IOException
OutputStream.write(int)
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
OutputStream.flush()
public void close() throws IOException
close
in interface Closeable
close
in class OutputStream
IOException
OutputStream.close()
|
SunSPOT host API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |