com.sun.spot.flashmanagement
Class FlashFileInputStream
java.lang.Object
java.io.InputStream
com.sun.spot.flashmanagement.FlashFileInputStream
- All Implemented Interfaces:
- Closeable
public class FlashFileInputStream
- extends InputStream
FlashFileInputStream represents an input 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 input stream accordingly, for example:
FlashFileInputStream ffis = new FlashFileInputStream(new FlashFile("my file"));
In this case, the input stream will signal end of file when the reader reaches the end of the
data that has been written to the FlashFile.
The second use of FlashFileInputStream is to stream over the flash memory in an arbitrary sector of the
flash memory. In this case, construct the input stream like this:
FlashFileInputStream ffis = new FlashFileInputStream(new NorFlashSector(mySectorNumber));
In this case, the input stream will signal end of file when the reader reaches the end of the
physical sector.
Method Summary |
int |
read()
|
int |
read(byte[] b,
int off,
int len)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FlashFileInputStream
public FlashFileInputStream(FlashFile file)
throws IOException
- Construct an input stream over the data previously written to a FlashFile
- Parameters:
file
- The FlashFile to read data from
- Throws:
IOException
- If the file does not exist
FlashFileInputStream
public FlashFileInputStream(IAddressableNorFlashSector sector)
- Construct a input stream over the raw data in a sector of the flash memory
- Parameters:
sector
- The sector to read data from
read
public int read(byte[] b,
int off,
int len)
throws IOException
- Overrides:
read
in class InputStream
- Throws:
IOException
- See Also:
InputStream.read(byte[], int, int)
read
public int read()
throws IOException
- Specified by:
read
in class InputStream
- Throws:
IOException
- See Also:
InputStream.read()
Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.