com.jmex.model.converters
Class FormatConverter

java.lang.Object
  extended by com.jmex.model.converters.FormatConverter
Direct Known Subclasses:
AseToJme, MaxToJme, Md2ToJme, Md3ToJme, MilkToJme, ObjToJme, X3dToJme

public abstract class FormatConverter
extends java.lang.Object

Started Date: Jul 1, 2004

This class is a base for all format converters and provides a generic framework to convert to jME format from any other format.

Author:
Jack Lindamood

Field Summary
(package private)  java.util.HashMap<java.lang.String,java.lang.Object> properties
          Contains a map of properties that tell the converter how to convert the format.
 
Constructor Summary
FormatConverter()
           
 
Method Summary
 void attemptFileConvert(java.lang.String[] args)
          Given an array of string arguments representing two files, the first file will be read and the second file will be deleted (if existing), then created and written to.
 void clearProperty(java.lang.String key)
          Removes a property.
abstract  void convert(java.io.InputStream format, java.io.OutputStream jMEFormat)
          Reads a given format and writes it to jMEFormat in the jME binary format.
 java.lang.Object getProperty(java.lang.String key)
          Returns the value of a property.
 void setProperty(java.lang.String key, java.lang.Object property)
          Adds a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

java.util.HashMap<java.lang.String,java.lang.Object> properties
Contains a map of properties that tell the converter how to convert the format.

Constructor Detail

FormatConverter

public FormatConverter()
Method Detail

convert

public abstract void convert(java.io.InputStream format,
                             java.io.OutputStream jMEFormat)
                      throws java.io.IOException
Reads a given format and writes it to jMEFormat in the jME binary format.

Parameters:
format - InputStream representing the format to read
jMEFormat - OutputStream to write the jME binary equivalent too
Throws:
java.io.IOException - If anything goes wrong during the writting

attemptFileConvert

public void attemptFileConvert(java.lang.String[] args)
Given an array of string arguments representing two files, the first file will be read and the second file will be deleted (if existing), then created and written to. Sample Usage "FormatConverter runner.txt runner.jme"

Parameters:
args - The array representing the from file and to file

setProperty

public void setProperty(java.lang.String key,
                        java.lang.Object property)
Adds a property. Properties can tell this how to process this format and are used in a format specific way. Look at the doc for the format to find what keys are used.

Parameters:
key - Key to add (For example "texdir")
property - Property for that key to have (For example "c:\\blarg\\")

getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns the value of a property.

Parameters:
key - Key of value to return (For example "texdir")
See Also:
setProperty(String, Object)

clearProperty

public void clearProperty(java.lang.String key)
Removes a property. Properties can tell this how to process this format and are used in a format specific way.

Parameters:
key - The property to remove