FreeHEP API
Version current

org.freehep.graphicsio.cgm
Class CGMWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.PrintWriter
          extended byorg.freehep.util.io.IndentPrintWriter
              extended byorg.freehep.graphicsio.cgm.CGMWriter
All Implemented Interfaces:
TaggedOutput

public class CGMWriter
extends IndentPrintWriter
implements TaggedOutput

CGM Clear Text Writer. Tags written with this Writer will produce a clear text CGM file. The class also holds the state for the various precisions, defaults, etc...

Version:
$Id: CGMWriter.java,v 1.5 2003/05/14 18:29:03 duns Exp $
Author:
Mark Donszelmann, Charles Loomis
Source Code:
CGMWriter.java

Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
CGMWriter(Writer writer)
          Constructs a Clear Text CGM Writer of version 1.
CGMWriter(Writer writer, int version)
          Constructs a Clear Text CGM writer of a specified version.
 
Method Summary
 int getVersion()
           
 void writeColor(Color c)
          Writes a Color (CO)
 void writeColorComponent(int c)
          Writes a Color Component (CCO)
 void writeColorDirect(Color c)
          Writes a Color Direct (CD)
 void writeColorIndex(int i)
          Writes a Color Index (CI)
 void writeData(byte[] data)
          Writes a chunk of Data (D)
 void writeFixedPoint(double d)
          Write a Fixed Point value (FX)
 void writeFloatingPoint(double d)
          Writes a Floating Point value (FP)
 void writeInteger(int i)
          Writes an Integer (I)
 void writeName(int name)
          Writes a Name (N)
 void writePoint(Point2D p)
          Writes a Point (P)
 void writeReal(double r)
          Writes a Real (R)
 void writeString(String s)
          Writes a String or String Fixed (S, SF)
 void writeTag(Tag tag)
          Writes a Tag and a Terminator (;)
 void writeVDC(double d)
          Writes a Virtual Display Coordinate (VDC)
 
Methods inherited from class org.freehep.util.io.IndentPrintWriter
getIndent, getIndentString, indent, outdent, print, print, print, print, print, print, print, print, print, println, setIndent, setIndentString
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.freehep.util.io.TaggedOutput
close
 

Constructor Detail

CGMWriter

public CGMWriter(Writer writer,
                 int version)
          throws IOException
Constructs a Clear Text CGM writer of a specified version.

Parameters:
writer - the underlying writer
version - the requested cgm version

CGMWriter

public CGMWriter(Writer writer)
          throws IOException
Constructs a Clear Text CGM Writer of version 1.

Parameters:
writer - the underlying writer.
Method Detail

writeFixedPoint

public void writeFixedPoint(double d)
                     throws IOException
Write a Fixed Point value (FX)

Parameters:
d - value to the written
Throws:
IOException

writeFloatingPoint

public void writeFloatingPoint(double d)
                        throws IOException
Writes a Floating Point value (FP)

Parameters:
d - value to be written
Throws:
IOException

writeColorIndex

public void writeColorIndex(int i)
                     throws IOException
Writes a Color Index (CI)

Parameters:
i - index to be written
Throws:
IOException

writeColorComponent

public void writeColorComponent(int c)
                         throws IOException
Writes a Color Component (CCO)

Parameters:
c - color component to be written
Throws:
IOException

writeColorDirect

public void writeColorDirect(Color c)
                      throws IOException
Writes a Color Direct (CD)

Parameters:
c - color to be written
Throws:
IOException

writeInteger

public void writeInteger(int i)
                  throws IOException
Writes an Integer (I)

Parameters:
i - integer to be written
Throws:
IOException

writeReal

public void writeReal(double r)
               throws IOException
Writes a Real (R)

Parameters:
r - value to be written
Throws:
IOException

writeString

public void writeString(String s)
                 throws IOException
Writes a String or String Fixed (S, SF)

Parameters:
s - string to be written
Throws:
IOException

writeData

public void writeData(byte[] data)
               throws IOException
Writes a chunk of Data (D)

Parameters:
data - data to be written
Throws:
IOException

writeVDC

public void writeVDC(double d)
              throws IOException
Writes a Virtual Display Coordinate (VDC)

Parameters:
d - VDC to be written
Throws:
IOException

writePoint

public void writePoint(Point2D p)
                throws IOException
Writes a Point (P)

Parameters:
p - value to be written
Throws:
IOException

writeColor

public void writeColor(Color c)
                throws IOException
Writes a Color (CO)

Parameters:
c - color to be written
Throws:
IOException

writeName

public void writeName(int name)
               throws IOException
Writes a Name (N)

Parameters:
name - name to be written
Throws:
IOException

writeTag

public void writeTag(Tag tag)
              throws IOException
Writes a Tag and a Terminator (;)

Specified by:
writeTag in interface TaggedOutput
Parameters:
tag - tag to be written
Throws:
IOException

getVersion

public int getVersion()
Returns:
the version of this CGM Writer

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.