SunSPOT host API V5.0


com.sun.spot.suiteconverter
Class Suite

java.lang.Object
  extended by com.sun.spot.suiteconverter.Suite

public class Suite
extends Object

Suite allows suite files to be saved in a form that can execute directly from SPOT flash memory. Squawk suites are normally saved in "canonical" form, where the base address of the bootstrap suite is assumed to be 0, the base address of child suites to be directly above the last word of the bootstrap suite, and so on for grandchildren. The suites also containg an OOP map that identifies which words are actually pointers. On the desktop, when a suite is loaded into memory, its pointers can then be remapped according to the actual address at which it finds itself, its parent, grandparent, and so on. On the SPOT, this remapping can't happen, as the suites are in flash memory. So instead, we remap them on the host before downloading to the device. This relies on the suites living at known addresses in SPOT virtual memory.


Field Summary
static short EXPECTED_SUITE_VERSION_MAJOR
           
static short EXPECTED_SUITE_VERSION_MINOR
           
 
Constructor Summary
Suite()
           
 
Method Summary
 int getHash()
           
 Suite getParent()
           
 void loadFromFile(String filename, String bootstrapFilename)
          Load a suite file from a File.
 void loadFromFile(String filename, String bootstrapFilename, int[] memoryAddrs)
          Deprecated. use loadFromFile(String, String)
 void loadFromStream(DataInputStream dis, String bootstrapFilename)
          Load a suite file from a DataInputStream.
 void relocateMemory(int[] memoryAddrs)
          Relocate the suite's object memory in accordance with the memory addresses supplied
 void writeToStream(DataOutputStream dos)
          Write the suite to a stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPECTED_SUITE_VERSION_MAJOR

public static final short EXPECTED_SUITE_VERSION_MAJOR
See Also:
Constant Field Values

EXPECTED_SUITE_VERSION_MINOR

public static final short EXPECTED_SUITE_VERSION_MINOR
See Also:
Constant Field Values
Constructor Detail

Suite

public Suite()
Method Detail

loadFromStream

public void loadFromStream(DataInputStream dis,
                           String bootstrapFilename)
                    throws IOException
Load a suite file from a DataInputStream. See also loadFromFile(String, String, int[])

Parameters:
dis - The DataInputStream to read the suite from
bootstrapFilename - A filepath to read the bootstrap suite from (note that this is NOT typically this suite's parent.
Throws:
IOException

writeToStream

public void writeToStream(DataOutputStream dos)
                   throws IOException
Write the suite to a stream

Parameters:
dos - the data output stream
Throws:
IOException

getHash

public int getHash()
Returns:
The calculated hash of this Suite.

relocateMemory

public void relocateMemory(int[] memoryAddrs)
Relocate the suite's object memory in accordance with the memory addresses supplied

Parameters:
memoryAddrs - An array of virtual memory addresses at which to assume suites will be mapped on the SPOT device. The first will be this suite's address, the second its parent, and so on until the the bootstrap address.

getParent

public Suite getParent()
Returns:
The loaded parent suite of this Suite
Throws:
IOException

loadFromFile

public void loadFromFile(String filename,
                         String bootstrapFilename,
                         int[] memoryAddrs)
                  throws IOException
Deprecated. use loadFromFile(String, String)

Load a suite file from a File. See also loadFromStream(DataInputStream, String)

Parameters:
filename - The filepath to read the suite from
bootstrapFilename - A filepath to read the bootstrap suite from (note that this is NOT typically this suite's parent.
memoryAddrs - This parameter is ignored and is only present for backwards compatibility.
Throws:
IOException

loadFromFile

public void loadFromFile(String filename,
                         String bootstrapFilename)
                  throws IOException
Load a suite file from a File. See also loadFromStream(DataInputStream, String)

Parameters:
filename - The filepath to read the suite from
bootstrapFilename - A filepath to read the bootstrap suite from (note that this is NOT typically this suite's parent.
Throws:
IOException

SunSPOT host API V5.0


Copyright © 2006-2008 Sun Microsystems, Inc. All Rights Reserved.