Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.squawk
Class Suite

    java.lang.Object
      com.sun.squawk.Suite

    public final class Suite

extends Object

A suite is the unit of deployment/compilation in the Squawk system.

Field Summary
`static int` | `APPLICATION` Denotes a suite that encapsulates an application.
`static int` | `DEBUG` Denotes a suite that is being debugged.
`static int` | `EXTENDABLE_LIBRARY` Denotes a suite that encapsulates an open library.
`static String` | `FILE_EXTENSION` File name extension that identifies a Suite, includes the '.'.
`static String` | `FILE_EXTENSION_API` File name extension that identifies a Suite's api, includes the '.'.
`static String` | `FILE_EXTENSION_METADATA` File name extension that identifies a Suite's metadata, includes the '.'.
`static int` | `LIBRARY` Denotes a suite that encapsulates a library.
`static int` | `METADATA` Denotes a suite that contains all the KlassMetadata for its parent suite.
`static String` | `PROPERTIES_MANIFEST_RESOURCE_NAME` Denotes the name of the resource that represents the resource name from which I extract properties from when an `installResource(ResourceFile)` is done.

Method Summary
`void` | `addNoClassDefFoundErrorClassNames(String[] classNames)` If a `Klass.forName(String)` is performed and class requested is not found AND its added to our list of `#classesToNoClassDefFoundError` then we will throw a `NoClassDefFoundError`.
`void` | `close()` Closes this suite.
`boolean` | `contains(Klass klass)` Returns true if this suite contains the given klass.
`boolean` | `equals(Object other)` Compares this suite with another object for equality.
`int` | `getClassCount()` Gets the number of classes in this suite.
`String` | `getConfiguration()` Gets the configuration of the suite.
`Klass` | `getKlass(int suiteID)` Gets the class in this suite corresponding to a given class number.
`String` | `getManifestProperty(String name)` Gets the value of an `PROPERTIES_MANIFEST_RESOURCE_NAME` property embedded in the suite.
`Enumeration` | `getManifestPropertyNames()` Gets the names of all manifest properties embedded in this suite.
`String` | `getName()` Gets this suite's name.
`int` | `getNextAvailableClassNumber()` Gets the next available number for a class that will be installed in this suite.
`Suite` | `getParent()` Gets the parent suite of this suite.
`InputStream` | `getResourceAsStream(String name, Klass klass)` Finds a resource with a given name.
`byte[]` | `getResourceData(String name)` Gets the contents of a resource file embedded in the suite.
`ResourceFile[]` | `getResourceFiles()` Return all of the resource files defined for this suite.
`static Suite` | `getSuite(String uri)` Gets the Suite corresponding to a given URI, loading it if necessary.
`static Suite` | `getSuite(String uri, boolean errorOnIOException)` Gets the Suite corresponding to a given URI, loading it if necessary.
`String` | `getURI()` Gets the URI identifier of the serialized form of this suite.
`int` | `hashCode()` Returns a hashcode for this suite which is derived solely from the suite's name.
`void` | `installClass(Klass klass)` Installs a given class into this suite.
`void` | `installProperty(ManifestProperty property)` Installs a collection of IMlet property values into this suite.
`void` | `installResource(ResourceFile resourceFile)` Installs a collection of resource files into this suite.
`boolean` | `isBootstrap()` Determines if this is the bootstrap suite containing the system classes.
`boolean` | `isClosed()` Determines if this suite is closed.
`protected void` | `loadProperties(byte[] bytes)` Parse properties from jar manifest file.
`Klass` | `lookup(String name)` Gets the `Klass` instance from this suite corresponding to a specified class name in internal form.
`void` | `save(DataOutputStream dos, String uri)` Serializes the object graph rooted by this suite and writes it to a given stream.
`ObjectMemory` | `save(DataOutputStream dos, String uri, boolean bigEndian)` Serializes the object graph rooted by this suite and writes it to a given stream.
`void` | `saveKlassMetadatas(DataOutputStream dos, String uri)` Serializes the object graph rooted by this suite and writes it to a given stream.
`void` | `saveKlassMetadatas(DataOutputStream dos, String uri, boolean bigEndian)` Serializes the object graph rooted by this suite and writes it to a given stream.
`void` | `setProperty(String key, String value)`
`void` | `setUnusedClasses(Klass[] klasses)`
`Suite` | `strip(int type, String name, Suite parent)` Creates a copy of this suite with its symbolic information stripped according to the given parameters.
`String` | `toString()` Gets a string representation of this suite.
`static String` | `typeToString(int suiteType)` Given one of the defined suite types, return an English string describing the suite type.

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### APPLICATION

    public static final int APPLICATION

  Denotes a suite that encapsulates an application. The classes of an application can not be linked against.

  See Also:
    Constant Field Values

### LIBRARY

    public static final int LIBRARY

  Denotes a suite that encapsulates a library. The classes of a library can be linked against but the library itself cannot be extended by virtue of other classes linking against it's package private components.

  See Also:
    Constant Field Values

### EXTENDABLE_LIBRARY

    public static final int EXTENDABLE_LIBRARY

  Denotes a suite that encapsulates an open library. The classes of an open library can be linked against and the library itself can be extended by virtue of other classes linking against it's package private components.

  See Also:
    Constant Field Values

### DEBUG

    public static final int DEBUG

  Denotes a suite that is being debugged. This suite retains all its symbolic information when closed.

  See Also:
    Constant Field Values

### METADATA

    public static final int METADATA

  Denotes a suite that contains all the KlassMetadata for its parent suite. This is to allow the parent suite to have zero symbolic information, but still have the information available.

  See Also:
    Constant Field Values

### FILE_EXTENSION

    public static final String FILE_EXTENSION

  File name extension that identifies a Suite, includes the '.'. Duplicated in builder, com.sun.squawk.builder.commands.MakeAPI

  See Also:
    Constant Field Values

### FILE_EXTENSION_API

    public static final String FILE_EXTENSION_API

  File name extension that identifies a Suite's api, includes the '.'. Duplicated in builder, com.sun.squawk.builder.commands.MakeAPI

  See Also:
    Constant Field Values

### FILE_EXTENSION_METADATA

    public static final String FILE_EXTENSION_METADATA

  File name extension that identifies a Suite's metadata, includes the '.'. Duplicated in builder, com.sun.squawk.builder.commands.MakeAPI

  See Also:
    Constant Field Values

### PROPERTIES_MANIFEST_RESOURCE_NAME

    public static final String PROPERTIES_MANIFEST_RESOURCE_NAME

  Denotes the name of the resource that represents the resource name from which I extract properties from when an `installResource(ResourceFile)` is done.

  See Also:
    Constant Field Values

Method Detail

### getName

    public String getName()

  Gets this suite's name.

  Returns:
    this suite's name

### getParent

    public Suite getParent()

  Gets the parent suite of this suite.

  Returns:
    the parent suite of this suite

### getURI

    public String getURI()

  Gets the URI identifier of the serialized form of this suite.

  Returns:
    the URI from which this suite was loaded or null if the suite was dynamically created

### getClassCount

    public int getClassCount()

  Gets the number of classes in this suite.

  Returns:
    the number of classes in this suite

### isClosed

    public boolean isClosed()

  Determines if this suite is closed. Open an open suite can have classes installed in it.

  Returns:
    boolean

### isBootstrap

    public boolean isBootstrap()

  Determines if this is the bootstrap suite containing the system classes.

  Returns:
    true if this suite has no parent

### getNextAvailableClassNumber

    public int getNextAvailableClassNumber()

  Gets the next available number for a class that will be installed in this suite. The value returned by this method will never be the same for this suite.

  Returns:
    the next available number for a class that will be installed in this suite

### getKlass

    public Klass getKlass(int suiteID)

  Gets the class in this suite corresponding to a given class number.

  Parameters:
    `suiteID` - the class number of the class to retrieve
  Returns:
    the class corresponding to `suiteID`

### getResourceData

    public byte[] getResourceData(String name)

  Gets the contents of a resource file embedded in the suite.

  Parameters:
    `name` - the name of the resource file whose contents is to be retrieved
  Returns:
    the resource data, or null if the resource file doesn't exist

### getResourceFiles

    public ResourceFile[] getResourceFiles()

  Return all of the resource files defined for this suite.

  Returns:

### getManifestPropertyNames

    public Enumeration getManifestPropertyNames()

  Gets the names of all manifest properties embedded in this suite.

  Returns:
    enumeration over the names

### getManifestProperty

    public String getManifestProperty(String name)

  Gets the value of an `PROPERTIES_MANIFEST_RESOURCE_NAME` property embedded in the suite.

  Parameters:
    `name` - the name of the property whose value is to be retrieved
  Returns:
    the property value

### getResourceAsStream

    public final InputStream getResourceAsStream(String name,
                                                 Klass klass)

  Finds a resource with a given name. This method returns null if no resource with this name is found. The rules for searching resources associated with a given class are profile specific.

  Parameters:
    `name` - name of the desired resource
    `klass` - Used to get the absolute path to resource if name is not absolute, if null, then assume resource name is absolute
  Returns:
    a `java.io.InputStream` object.
  Since:
    JDK1.1

### toString

    public String toString()

  Gets a string representation of this suite. The string returned is name of this suite with "suite " prepended.

  Overrides:
    `toString` in class `Object`
  Returns:
    the name of this suite with "suite " prepended

### installClass

    public void installClass(Klass klass)

  Installs a given class into this suite.

  Parameters:
    `klass` - the class to install

### setUnusedClasses

    public void setUnusedClasses(Klass[] klasses)

### addNoClassDefFoundErrorClassNames

    public void addNoClassDefFoundErrorClassNames(String[] classNames)

  If a `Klass.forName(String)` is performed and class requested is not found AND its added to our list of `#classesToNoClassDefFoundError` then we will throw a `NoClassDefFoundError`.

  Parameters:
    `classNames` -

### installResource

    public void installResource(ResourceFile resourceFile)

  Installs a collection of resource files into this suite.

  Parameters:
    `resourceFile` - file to install

### loadProperties

    protected void loadProperties(byte[] bytes)

  Parse properties from jar manifest file. Based on manifest spec: http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html ABOUT "application descriptors", WHICH ARE NOT SUPPORTED BY THIS METHOD: Note that this syntax is slightly different than the "application descriptor" syntax in the IMP and MIDP specs. An "application descriptor" does not support "continuation lines", or trailing spaces in a value. This is an known annoyance of the MIDP spec. In addition, the MIDP 1.0 and IMP 1.0 specs have in a bug in the BNF, such that white space is REQUIRED before and after the value. The MIDP 2.0 specs correctly show that such white space is optional.

### setProperty

    public void setProperty(String key,
                            String value)

### installProperty

    public void installProperty(ManifestProperty property)

  Installs a collection of IMlet property values into this suite.

  Parameters:
    `property` - IMlet property to install

### lookup

    public Klass lookup(String name)

  Gets the `Klass` instance from this suite corresponding to a specified class name in internal form.

  Parameters:
    `name` - the name (in internal form) of the class to lookup
  Returns:
    the `Klass` instance corresponding to `internalName` or `null` if there isn't one.

### contains

    public boolean contains(Klass klass)

  Returns true if this suite contains the given klass.

  Parameters:
    `klass` - the klass
  Returns:
    true if klass belongs to this suite

### equals

    public final boolean equals(Object other)

  Compares this suite with another object for equality. The result is true if and only if `other` is a `Suite` instance and its name is equal to this suite's name.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `other` - the object to compare this suite against
  Returns:
    true if `other` is a `Suite` instance and its name is equal to this suite's name
  See Also:
    `Boolean.hashCode()`, `Hashtable`

### hashCode

    public final int hashCode()

  Returns a hashcode for this suite which is derived solely from the suite's name.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    the hashcode of this suite's name
  See Also:
    `Object.equals(java.lang.Object)`, `Hashtable`

### getSuite

    public static Suite getSuite(String uri,
                                 boolean errorOnIOException)
                          throws Error

  Gets the Suite corresponding to a given URI, loading it if necessary.

  Parameters:
    `uri` - the URI identifying the object memory
    `errorOnIOException` - if true, throw an Error if an IOException occurs, otherwise return null.
  Returns:
    the Suite inside the object memory identified by `uri`
  Throws:
    `Error` - if the suite denoted by URI is not available or there was a problem while loading it

### getSuite

    public static Suite getSuite(String uri)
                          throws Error

  Gets the Suite corresponding to a given URI, loading it if necessary.

  Parameters:
    `uri` - the URI identifying the object memory
  Returns:
    the Suite inside the object memory identified by `uri`
  Throws:
    `Error` - if the suite denoted by URI is not available or there was a problem while loading it

### getConfiguration

    public String getConfiguration()

  Gets the configuration of the suite.

  Returns:
    the configuration of the suite

### save

    public void save(DataOutputStream dos,
                     String uri)
              throws IOException,
                     OutOfMemoryError

  Serializes the object graph rooted by this suite and writes it to a given stream. The endianess of the serialized object graph is the endianess of the unerdlying platform.

  Parameters:
    `dos` - the DataOutputStream to which the serialized suite should be written
    `uri` - the URI identifier of the serialized suite
  Throws:
    `OutOfMemoryError` - if there was insufficient memory to do the save
    `IOException` - if there was some IO problem while writing the output

### save

    public ObjectMemory save(DataOutputStream dos,
                             String uri,
                             boolean bigEndian)
                      throws IOException,
                             OutOfMemoryError

  Serializes the object graph rooted by this suite and writes it to a given stream.

  Parameters:
    `dos` - the DataOutputStream to which the serialized suite should be written
    `uri` - the URI identifier of the serialized suite
    `bigEndian` - the endianess to be used when serializing this suite
  Returns:
    if hosted, returns the objectMemory that suite was saved to
  Throws:
    `OutOfMemoryError` - if there was insufficient memory to do the save
    `IOException` - if there was some IO problem while writing the output

### saveKlassMetadatas

    public void saveKlassMetadatas(DataOutputStream dos,
                                   String uri)
                            throws IOException,
                                   OutOfMemoryError

  Serializes the object graph rooted by this suite and writes it to a given stream. The endianess of the serialized object graph is the endianess of the unerdlying platform.

  Parameters:
    `dos` - the DataOutputStream to which the serialized suite should be written
    `uri` - the URI identifier of the serialized suite
  Throws:
    `OutOfMemoryError` - if there was insufficient memory to do the save
    `IOException` - if there was some IO problem while writing the output

### saveKlassMetadatas

    public void saveKlassMetadatas(DataOutputStream dos,
                                   String uri,
                                   boolean bigEndian)
                            throws IOException,
                                   OutOfMemoryError

  Serializes the object graph rooted by this suite and writes it to a given stream.

  Parameters:
    `dos` - the DataOutputStream to which the serialized suite should be written
    `uri` - the URI identifier of the serialized suite
    `bigEndian` - the endianess to be used when serializing this suite
  Throws:
    `OutOfMemoryError` - if there was insufficient memory to do the save
    `IOException` - if there was some IO problem while writing the output

### typeToString

    public static String typeToString(int suiteType)

  Given one of the defined suite types, return an English string describing the suite type.

  Parameters:
    `suiteType` - One of APPLICATION, LIBRARY, EXTENDABLE_LIBRARY, or DEBUG.
  Returns:
    a string descibing the suite type.

### close

    public void close()

  Closes this suite. Once closed, a suite is immutable (and may well reside in read-only memory) and cannot have any more classes installed in it

### strip

    public Suite strip(int type,
                       String name,
                       Suite parent)

  Creates a copy of this suite with its symbolic information stripped according to the given parameters.

  Parameters:
    `type` - specifies the type of the suite after closing. Must be `APPLICATION`, `LIBRARY`, `EXTENDABLE_LIBRARY` or `DEBUG`.
    `name` - new suite name
    `parent` -
  Returns:
    stripped copy of this suite

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"