SunSPOT API V2.0


com.sun.spot.peripheral
Class FlashInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.sun.spot.peripheral.FlashInputStream

public class FlashInputStream
extends InputStream

An InputStream that streams over flash memory.


Constructor Summary
FlashInputStream(IFlashMemoryDevice device, int startSectorNum, int numOfSectors)
          Create an InputStream that streams over specified sectors of a flash device
 
Method Summary
 int available()
          Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream.
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 int read()
          Reads the next byte of data from the input stream.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlashInputStream

public FlashInputStream(IFlashMemoryDevice device,
                        int startSectorNum,
                        int numOfSectors)
Create an InputStream that streams over specified sectors of a flash device

Parameters:
device - The memory device
startSectorNum - The first sector to use (zero based)
numOfSectors - The number of sectors to use
Method Detail

read

public int read()
Description copied from class: InputStream
Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

A subclass must provide an implementation of this method.

Specified by:
read in class InputStream
Returns:
the next byte of data, or -1 if the end of the stream is reached.

close

public void close()
Description copied from class: InputStream
Closes this input stream and releases any system resources associated with the stream.

The close method of InputStream does nothing.

Overrides:
close in class InputStream

available

public int available()
Description copied from class: InputStream
Returns the number of bytes that can be read (or skipped over) from this input stream without blocking by the next caller of a method for this input stream. The next caller might be the same thread or another thread.

The available method for class InputStream always returns 0.

This method should be overridden by subclasses.

Overrides:
available in class InputStream
Returns:
the number of bytes that can be read from this input stream without blocking.

SunSPOT API V2.0


Copyright © 2007 Sun Microsystems, Inc. All Rights Reserved.