org.xith3d.io
Class ScribeOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.DataOutputStream
              extended by org.xith3d.io.ScribeOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataOutput, java.io.Flushable

public class ScribeOutputStream
extends java.io.DataOutputStream

An output stream derived from DataOutputStream for writing out cosm objects to streams. ExtScribable objects which are written to the stream have their class type stored so they can be rebuilt when they are read. Each class name will be only stored once per file to reduce storage. :Id: ScribeOutputStream.java,v 1.10 2003/02/24 00:13:44 wurp Exp $ :Log: ScribeOutputStream.java,v $ Revision 1.10 2003/02/24 00:13:44 wurp Formatted all java code for cvs (strictSunConvention.xml) Revision 1.9 2002/09/11 00:53:53 dilvish Big commit of new changes Revision 1.8 2002/01/23 04:38:33 wurp Integrating i18n code Revision 1.7 2002/01/20 05:26:02 dilvish JDK 1.4 port Revision 1.6 2002/01/15 03:36:55 dilvish Improvements to the animation system Revision 1.5 2002/01/12 03:16:27 dilvish Added read/write of buffered images Revision 1.4 2001/11/17 03:13:02 dilvish Added the ability to read/write arrays of vectors Revision 1.3 2001/07/14 14:48:10 wurp New animation, sky and avatar movement Revision 1.2 2001/06/20 04:05:41 wurp added log4j. Revision 1.1 2001/06/06 22:42:37 wizofid Massive commit / reintegration


Field Summary
protected static int CLASS_DEF
           
protected static int CLASS_REF
           
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
ScribeOutputStream(java.io.OutputStream stream)
           
 
Method Summary
 void writeByteArray(byte[] data)
          Writes out a complete array of byte
 void writeByteArray(byte[] data, int len)
          Writes out an array of byte, using the number of elements specified
 void writeColor3f(org.openmali.vecmath2.Colorf v)
           
 void writeDirectImage(org.jagatoo.image.DirectBufferedImage dbi)
           
 void writeFloatArray(float[] data)
          Writes out a complete array of float
 void writeFloatArray(float[] data, int len)
          Writes out an array of float, using the number of elements specified
 void writeImage(java.awt.image.BufferedImage b)
          writes out a buffered image.
 void writeIntArray(int[] data)
          Writes out a complete array of int
 void writeIntArray(int[] data, int len)
          Writes out an array of int, using the number of elements specified
 void writeLossyImage(java.awt.image.BufferedImage b, float quality)
          Writes the buffered image to the file using lossy JPG compression.
 void writeMatrix(org.openmali.vecmath2.Matrix3f v)
           
 void writeMatrix(org.openmali.vecmath2.Matrix4f v)
           
 void writePoint(org.openmali.vecmath2.Point3f p)
           
 void writeQuat(org.openmali.vecmath2.Quaternion4f v)
           
 void writeScribable(Scribable o)
          Writes a scribable node to the output stream.
 void writeShortArray(short[] data)
           
 void writeShortArray(short[] data, int len)
           
 void writeString(java.lang.String s)
          Writes out a string
 void writeTexCoord(org.openmali.vecmath2.TexCoord2f v)
           
 void writeVector(org.openmali.vecmath2.Vector3f v)
           
 void writeVectorArray(org.openmali.vecmath2.Vector3f[] data)
          Writes out a complete array of float
 void writeVectorArray(org.openmali.vecmath2.Vector3f[] data, int len)
          Writes out an array of float, using the number of elements specified
 
Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataOutput
write
 

Field Detail

CLASS_REF

protected static final int CLASS_REF
See Also:
Constant Field Values

CLASS_DEF

protected static final int CLASS_DEF
See Also:
Constant Field Values
Constructor Detail

ScribeOutputStream

public ScribeOutputStream(java.io.OutputStream stream)
Method Detail

writeScribable

public void writeScribable(Scribable o)
                    throws java.io.IOException,
                           UnscribableNodeEncountered
Writes a scribable node to the output stream. Either the class or a class reference is written to the output file, followed by the scribed object.

Throws:
java.io.IOException
UnscribableNodeEncountered

writeFloatArray

public void writeFloatArray(float[] data,
                            int len)
                     throws java.io.IOException
Writes out an array of float, using the number of elements specified

Throws:
java.io.IOException

writeFloatArray

public void writeFloatArray(float[] data)
                     throws java.io.IOException
Writes out a complete array of float

Throws:
java.io.IOException

writeByteArray

public void writeByteArray(byte[] data,
                           int len)
                    throws java.io.IOException
Writes out an array of byte, using the number of elements specified

Throws:
java.io.IOException

writeByteArray

public void writeByteArray(byte[] data)
                    throws java.io.IOException
Writes out a complete array of byte

Throws:
java.io.IOException

writeVectorArray

public void writeVectorArray(org.openmali.vecmath2.Vector3f[] data,
                             int len)
                      throws java.io.IOException
Writes out an array of float, using the number of elements specified

Throws:
java.io.IOException

writeVectorArray

public void writeVectorArray(org.openmali.vecmath2.Vector3f[] data)
                      throws java.io.IOException
Writes out a complete array of float

Throws:
java.io.IOException

writeIntArray

public void writeIntArray(int[] data,
                          int len)
                   throws java.io.IOException
Writes out an array of int, using the number of elements specified

Throws:
java.io.IOException

writeShortArray

public void writeShortArray(short[] data,
                            int len)
                     throws java.io.IOException
Throws:
java.io.IOException

writeIntArray

public void writeIntArray(int[] data)
                   throws java.io.IOException
Writes out a complete array of int

Throws:
java.io.IOException

writeShortArray

public void writeShortArray(short[] data)
                     throws java.io.IOException
Throws:
java.io.IOException

writeString

public void writeString(java.lang.String s)
                 throws java.io.IOException
Writes out a string

Throws:
java.io.IOException

writePoint

public void writePoint(org.openmali.vecmath2.Point3f p)
                throws java.io.IOException
Throws:
java.io.IOException

writeVector

public void writeVector(org.openmali.vecmath2.Vector3f v)
                 throws java.io.IOException
Throws:
java.io.IOException

writeColor3f

public void writeColor3f(org.openmali.vecmath2.Colorf v)
                  throws java.io.IOException
Throws:
java.io.IOException

writeQuat

public void writeQuat(org.openmali.vecmath2.Quaternion4f v)
               throws java.io.IOException
Throws:
java.io.IOException

writeTexCoord

public void writeTexCoord(org.openmali.vecmath2.TexCoord2f v)
                   throws java.io.IOException
Throws:
java.io.IOException

writeMatrix

public void writeMatrix(org.openmali.vecmath2.Matrix3f v)
                 throws java.io.IOException
Throws:
java.io.IOException

writeMatrix

public void writeMatrix(org.openmali.vecmath2.Matrix4f v)
                 throws java.io.IOException
Throws:
java.io.IOException

writeDirectImage

public void writeDirectImage(org.jagatoo.image.DirectBufferedImage dbi)
                      throws java.io.IOException
Throws:
java.io.IOException

writeImage

public void writeImage(java.awt.image.BufferedImage b)
                throws java.io.IOException
writes out a buffered image. It is acceptable to pass in null since a byte is written to determine if there is an image or not. This writes out the raw image data, which can be a lot of disk space since there is no special compression being done for images.

Throws:
java.io.IOException

writeLossyImage

public void writeLossyImage(java.awt.image.BufferedImage b,
                            float quality)
                     throws java.io.IOException
Writes the buffered image to the file using lossy JPG compression.

Parameters:
b - The image to save
quality - The quality of the output
Throws:
java.io.IOException