Rings
Version 0.3

threeD.io
Class FileDecoder

java.lang.Object
  extended bythreeD.io.FileDecoder

public class FileDecoder
extends java.lang.Object

The FileDecoder class provides static methods for decoding scene and surface data that has been stored in a file.


Field Summary
static int GTSEncoding
          The integer code for a GTS encoding.
static int RAWEncoding
          The integer code for a RAW encoding.
static int XMLEncoding
          The integer code for an XML encoding.
 
Constructor Summary
FileDecoder()
           
 
Method Summary
static Scene decodeScene(java.io.InputStream fileIn, int encoding, boolean ui, java.beans.ExceptionListener listener)
          Decodes the scene data read from the specified InputStream object using the encoding specified by the integer encoding code and returnes the new Scene object.
static Scene decodeSceneFile(java.io.File file, int encoding, boolean ui, java.beans.ExceptionListener listener)
          Decodes the scene data stored in the file represented by the specified File object using the encoding specified by the integer encoding code and returns the new Scene object.
static Surface decodeSurfaceFile(java.io.File file, int encoding, boolean ui, java.beans.ExceptionListener listener)
          Decodes the surface data stored in the file represented by the specified File object using the encoding specified by the integer encoding code and returns the new Surface object.
static double[] parseDoubles(java.lang.String s)
          Parses a series of double values separated by spaces and returnes an array containing the values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XMLEncoding

public static final int XMLEncoding
The integer code for an XML encoding.

See Also:
Constant Field Values

RAWEncoding

public static final int RAWEncoding
The integer code for a RAW encoding.

See Also:
Constant Field Values

GTSEncoding

public static final int GTSEncoding
The integer code for a GTS encoding.

See Also:
Constant Field Values
Constructor Detail

FileDecoder

public FileDecoder()
Method Detail

decodeSceneFile

public static Scene decodeSceneFile(java.io.File file,
                                    int encoding,
                                    boolean ui,
                                    java.beans.ExceptionListener listener)
                             throws java.io.IOException,
                                    java.io.FileNotFoundException
Decodes the scene data stored in the file represented by the specified File object using the encoding specified by the integer encoding code and returns the new Scene object. If ui is true only SurfaceUI objects will be used. The specified ExceptionListener is notified if an exception occurs when using an XMLDecoder. This method returns null if the encoding is not supported.

Throws:
java.io.IOException - If an IO error occurs.
java.io.FileNotFoundException - If the file is not found.

decodeScene

public static Scene decodeScene(java.io.InputStream fileIn,
                                int encoding,
                                boolean ui,
                                java.beans.ExceptionListener listener)
                         throws java.io.IOException
Decodes the scene data read from the specified InputStream object using the encoding specified by the integer encoding code and returnes the new Scene object. If ui is true only SurfaceUI objects will be used. The specified ExceptionListener is notified if an exception occurs when using an XMLDecoder. This method returns null if the encoding is not supported.

Throws:
java.io.IOException

decodeSurfaceFile

public static Surface decodeSurfaceFile(java.io.File file,
                                        int encoding,
                                        boolean ui,
                                        java.beans.ExceptionListener listener)
                                 throws java.io.IOException,
                                        java.io.FileNotFoundException
Decodes the surface data stored in the file represented by the specified File object using the encoding specified by the integer encoding code and returns the new Surface object. If ui is true a SurfaceUI object will be returned. The specified ExceptionListener is notified if an exception occurs when using an XMLDecoder. The decodeSurfaceFile method returns null if the encoding is not supported.

Throws:
java.io.IOException - If an IO error occurs.
java.io.FileNotFoundException - If the file is not found.

parseDoubles

public static double[] parseDoubles(java.lang.String s)
Parses a series of double values separated by spaces and returnes an array containing the values.

Throws:
java.lang.NumberFormatException - If a number is not correctly formatted.

Rings
Version 0.3

Copyright 2003-05 Mike Murray