kiwi.util
Class ResourceDecoder

java.lang.Object
  extended bykiwi.util.ResourceDecoder
All Implemented Interfaces:
java.awt.image.ImageObserver

public class ResourceDecoder
extends java.lang.Object
implements java.awt.image.ImageObserver

A class that decodes various types of resources from input streams. This class is used by resource loaders to read resources from files or network connections. The functionality is provided for its possible use in other contexts.

Since:
Kiwi 1.3
Author:
Mark Lindner, PING Software Group
See Also:
ResourceLoader, ResourceManager

Field Summary
private static boolean imageLoaded
           
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ResourceDecoder()
          Construct a new ResourceDecoder.
 
Method Summary
 AudioClip decodeAudioClip(java.io.InputStream stream)
          Decode an audio clip from an input stream.
 Config decodeConfig(java.io.InputStream stream)
          Decode a configuration from an input stream.
 java.awt.Image decodeImage(java.io.InputStream stream)
          Decode an image from an input stream.
 java.util.Properties decodeProperties(java.io.InputStream stream)
          Decode a properties list from an input stream.
 java.lang.String decodeString(java.io.InputStream stream)
          Decode a string from an input stream.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int w, int h)
          Image tracker method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageLoaded

private static boolean imageLoaded
Constructor Detail

ResourceDecoder

public ResourceDecoder()
Construct a new ResourceDecoder.

Method Detail

decodeString

public java.lang.String decodeString(java.io.InputStream stream)
                              throws java.io.IOException
Decode a string from an input stream. Constructs a String object from all of the data read from an input stream.

Parameters:
stream - The input stream.
Returns:
The resulting String object.
Throws:
java.io.IOException - If an error occurred while reading from the stream.

decodeAudioClip

public AudioClip decodeAudioClip(java.io.InputStream stream)
                          throws java.io.IOException
Decode an audio clip from an input stream. Constructs an AudioClip object from all of the data read from an input stream.

Parameters:
stream - The input stream.
Returns:
The resulting AudioCip object.
Throws:
java.io.IOException - If an error occurred while reading from the stream.

decodeImage

public java.awt.Image decodeImage(java.io.InputStream stream)
                           throws java.io.IOException
Decode an image from an input stream. Constructs an Image object from all of the data read from an input stream.

Parameters:
stream - The input stream.
Returns:
The resulting Image object.
Throws:
java.io.IOException - If an error occurred while reading from the stream.

decodeProperties

public java.util.Properties decodeProperties(java.io.InputStream stream)
                                      throws java.io.IOException
Decode a properties list from an input stream. Constructs a Properties object from all of the data read from an input stream.

Parameters:
stream - The input stream.
Returns:
The resulting Properties object.
Throws:
java.io.IOException - If an error occurred while reading from the stream.

decodeConfig

public Config decodeConfig(java.io.InputStream stream)
                    throws java.io.IOException
Decode a configuration from an input stream. Constructs a Config object from all of the data read from an input stream.

Parameters:
stream - The input stream.
Returns:
The resulting Config object.
Throws:
java.io.IOException - If an error occurred while reading from the stream.

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int w,
                           int h)
Image tracker method. This is an internal method and should not be called directly.

Specified by:
imageUpdate in interface java.awt.image.ImageObserver