ilog.views.io
Class IlvOutputStream

java.lang.Object
  extended by ilog.views.io.IlvOutputStream
Direct Known Subclasses:
IlvMapOutputStream, SVGOutputStream

public class IlvOutputStream
extends Object

This class writes an IlvManager to a stream that can be read by the class IlvInputStream. This class provides a wide range of methods that allow you to write the fields of a graphic object. To write your graphic object in an IlvOutputStream, you override the write method of IlvGraphic. The corresponding read operation must be done in a constructor of your graphic object that takes an IlvInputStream parameter.

See Also:
IlvInputStream, IlvGraphic.write(ilog.views.io.IlvOutputStream), IlvManager.read(java.io.InputStream)

Constructor Summary
IlvOutputStream(OutputStream stream)
          Creates an IlvOutputStream from an OutputStream.
IlvOutputStream(OutputStream stream, boolean binary)
          Creates an IlvOutputStream from an OutputStream.
 
Method Summary
protected  IlvGraphicEnumeration filterObjects(IlvGraphicEnumeration objs, boolean copypaste)
          Allows subclasses of IlvOutputStream to filter the graphic objects that will be actually saved to the file.
 void flush()
          Flushes the underlying output stream.
 boolean getBinary()
          Returns the saving type of this IlvOutputStream.
 IlvManager getManager()
          Returns the manager that is written.
 void setBinary()
          Changes the stream saving type to the binary IVL format.
protected  void write(IlvGraphic obj)
          Writes an IlvGraphic.
 void write(IlvManager manager)
          Writes a manager to an IlvOutputStream.
 void write(IlvManager manager, boolean writeSelection)
          Writes a manager to an IlvOutputStream.
 void write(IlvManagerLayer[] layers, boolean useCopyPaste)
          Writes the layers of a manager.
 void write(String field, BasicStroke v)
          Writes a single AWT BasicStroke field.
 void write(String field, boolean v)
          Writes a single value boolean field.
 void write(String field, boolean[] v)
          Writes a multiple value boolean field.
 void write(String field, Color v)
          Writes a single value Color field.
 void write(String field, Color[] v)
          Writes a multiple value Color field.
 void write(String field, double v)
          Writes a single value double field.
 void write(String field, double[] v)
          Writes a multiple value double field.
 void write(String field, Enumeration objs)
          Writes an enumeration of IlvPersistentObject field.
 void write(String field, float v)
          Writes a single value float field.
 void write(String field, float[] v)
          Writes a multiple value float field.
 void write(String field, Font v)
          Writes a single value Font field.
 void write(String field, Font[] v)
          Writes a multiple value Font field.
 void write(String field, GradientPaint v)
          Writes a single AWT Gradient field.
 void write(String field, IlvGraphic obj)
          Writes an IlvGraphic field.
 void write(String field, IlvGraphic[] objs)
          Writes an IlvGraphic[] field.
 void write(String field, IlvGraphic[] objs, int start, int end)
          Writes an IlvGraphic[] field.
 void write(String field, IlvGraphicEnumeration objs)
          Writes an IlvGraphicEnumeration field.
 void write(String field, IlvGraphicEnumeration objs, boolean filter)
          Writes an IlvGraphicEnumeration field.
 void write(String field, IlvPattern v)
          Writes a pattern field.
 void write(String field, IlvPersistentObject obj)
          Writes an IlvPersistentObject field.
 void write(String field, IlvPersistentObject[] objs)
          Writes an IlvPersistentObject[] field.
 void write(String field, IlvPersistentObject[] objs, int start, int end)
          Writes an IlvPersistentObject[] field.
 void write(String field, IlvPoint v)
          Writes a single value IlvPoint field.
 void write(String field, IlvPoint[] v)
          Writes a multiple value IlvPoint field.
 void write(String field, IlvRect v)
          Writes a single value IlvRect field.
 void write(String field, IlvRect[] v)
          Writes a multiple value IlvRect field.
 void write(String field, IlvTexture v)
          Writes a texture field.
 void write(String field, IlvTransformer v)
          Writes a single value transformer field.
 void write(String field, IlvTransformer[] v)
          Writes a multiple value transformer field.
 void write(String field, int v)
          Writes a single value integer field.
 void write(String field, int[] v)
          Writes a multiple value integer field.
 void write(String field, long v)
          Writes a single value long field.
 void write(String field, long[] v)
          Writes a multiple value long field.
 void write(String field, Object[] objs, String spec)
          Writes a nested Object[] field.
 void write(String field, short v)
          Writes a single value short field.
 void write(String field, short[] v)
          Writes a multiple value short field.
 void write(String field, String v)
          Writes a single value String field.
 void write(String field, String[] v)
          Writes a multiple value String field.
 void write(String pathfield, String rulefield, Shape shape)
          Writes a Java 2D Shape object.
protected  void writeExtensions(boolean copypaste)
          Writes additional information to an IlvOutputStream.
 void writeGradient(String field, GradientPaint v)
          Deprecated. Since JViews 5.0; use the write method.
 void writePattern(String field, IlvPattern v)
          Deprecated. Since JViews 5.0; use the write method.
 void writeStroke(String field, BasicStroke v)
          Deprecated. Since JViews 5.0; use the write method.
 void writeTexture(String field, IlvTexture v)
          Deprecated. Since JViews 5.0; use the write method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvOutputStream

public IlvOutputStream(OutputStream stream)
Creates an IlvOutputStream from an OutputStream. This stream is in ASCII mode.

Parameters:
stream - The output stream.

IlvOutputStream

public IlvOutputStream(OutputStream stream,
                       boolean binary)
Creates an IlvOutputStream from an OutputStream.

Parameters:
stream - The output stream.
binary - If true, the stream will contain binary data.
Method Detail

setBinary

public final void setBinary()
Changes the stream saving type to the binary IVL format. This method must be called just after the stream was created and not changed during the save operation.


getBinary

public final boolean getBinary()
Returns the saving type of this IlvOutputStream.

Since:
JViews 5.0
See Also:
setBinary()

write

public void write(IlvManager manager,
                  boolean writeSelection)
           throws IOException
Writes a manager to an IlvOutputStream. You should not use this method; this method is public for implementation purposes.

Parameters:
manager - The manager to save.
writeSelection - If true then saves only selected objects but does not save layer information.
Throws:
IOException - usual IO errors.

write

public void write(IlvManager manager)
           throws IOException
Writes a manager to an IlvOutputStream.

Parameters:
manager - The manager to save.
Throws:
IOException - usual IO errors.

getManager

public final IlvManager getManager()
Returns the manager that is written.


write

public void write(IlvManagerLayer[] layers,
                  boolean useCopyPaste)
           throws IOException
Writes the layers of a manager. This method is called by the manager to store its layer. You should not call this method directly. Instead you may use IlvManager.write(String filename).

Throws:
IOException

write

public final void write(String field,
                        boolean v)
                 throws IOException
Writes a single value boolean field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        boolean[] v)
                 throws IOException
Writes a multiple value boolean field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        short v)
                 throws IOException
Writes a single value short field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        short[] v)
                 throws IOException
Writes a multiple value short field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        int v)
                 throws IOException
Writes a single value integer field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        int[] v)
                 throws IOException
Writes a multiple value integer field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        long v)
                 throws IOException
Writes a single value long field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        long[] v)
                 throws IOException
Writes a multiple value long field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        float v)
                 throws IOException
Writes a single value float field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        float[] v)
                 throws IOException
Writes a multiple value float field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        double v)
                 throws IOException
Writes a single value double field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        double[] v)
                 throws IOException
Writes a multiple value double field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        String v)
                 throws IOException
Writes a single value String field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        String[] v)
                 throws IOException
Writes a multiple value String field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvRect v)
                 throws IOException
Writes a single value IlvRect field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvRect[] v)
                 throws IOException
Writes a multiple value IlvRect field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvPoint v)
                 throws IOException
Writes a single value IlvPoint field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvPoint[] v)
                 throws IOException
Writes a multiple value IlvPoint field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvTransformer v)
                 throws IOException
Writes a single value transformer field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvTransformer[] v)
                 throws IOException
Writes a multiple value transformer field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        Font v)
                 throws IOException
Writes a single value Font field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        Font[] v)
                 throws IOException
Writes a multiple value Font field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        Color v)
                 throws IOException
Writes a single value Color field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        Color[] v)
                 throws IOException
Writes a multiple value Color field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String pathfield,
                        String rulefield,
                        Shape shape)
                 throws IOException
Writes a Java 2D Shape object.

Parameters:
pathfield - The name of the path field.
rulefield - The name of the winding rule field.
shape - The Shape to write.
Throws:
IOException

write

public final void write(String field,
                        GradientPaint v)
                 throws IOException
Writes a single AWT Gradient field. It allows you to store a java.awt.GradientPaint.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.
Since:
JViews 5.0

writeGradient

public final void writeGradient(String field,
                                GradientPaint v)
                         throws IOException
Deprecated. Since JViews 5.0; use the write method.

Writes a single AWT Gradient field. It allows you to store a java.awt.GradientPaint.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvPattern v)
                 throws IOException
Writes a pattern field. It allows you to store an IlvPattern instance.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.
Since:
JViews 5.0
See Also:
IlvPattern

writePattern

public final void writePattern(String field,
                               IlvPattern v)
                        throws IOException
Deprecated. Since JViews 5.0; use the write method.

Writes a pattern field. It allows you to store an IlvPattern instance.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.
See Also:
IlvPattern

write

public final void write(String field,
                        IlvTexture v)
                 throws IOException
Writes a texture field. It allows you to store an IlvTexture instance.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.
Since:
JViews 5.0
See Also:
IlvTexture

writeTexture

public final void writeTexture(String field,
                               IlvTexture v)
                        throws IOException
Deprecated. Since JViews 5.0; use the write method

Writes a texture field. It allows you to store an IlvTexture instance.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.
See Also:
IlvTexture

write

public final void write(String field,
                        BasicStroke v)
                 throws IOException
Writes a single AWT BasicStroke field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.
Since:
JViews 5.0

writeStroke

public final void writeStroke(String field,
                              BasicStroke v)
                       throws IOException
Deprecated. Since JViews 5.0; use the write method.

Writes a single AWT Stroke field.

Parameters:
field - The name of the field.
v - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvPersistentObject obj)
                 throws IOException
Writes an IlvPersistentObject field. Note that if you write the same object several times, the object is only written once, the first time. The other calls to write will save a reference to this object.

Parameters:
field - The name of the field.
obj - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvPersistentObject[] objs)
                 throws IOException
Writes an IlvPersistentObject[] field.

Parameters:
field - The name of the field.
objs - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvPersistentObject[] objs,
                        int start,
                        int end)
                 throws IOException
Writes an IlvPersistentObject[] field.

Parameters:
field - The name of the field.
objs - The value of the field.
start - Index of the first object to save.
end - Index of the last object to save.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        Enumeration objs)
                 throws IOException
Writes an enumeration of IlvPersistentObject field.

Parameters:
field - The name of the field.
objs - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvGraphic obj)
                 throws IOException
Writes an IlvGraphic field. Note that if you write the same object several times, the object is only written once, the first time. The other calls to write will save a reference to this object.

Parameters:
field - The name of the field.
obj - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvGraphic[] objs)
                 throws IOException
Writes an IlvGraphic[] field. IlvGraphic instances for which IlvGraphic.isPersistent() return false will not be saved.

Parameters:
field - The name of the field.
objs - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvGraphic[] objs,
                        int start,
                        int end)
                 throws IOException
Writes an IlvGraphic[] field.

Parameters:
field - The name of the field.
objs - The value of the field.
start - Index of the first object to save.
end - Index of the last object to save.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvGraphicEnumeration objs)
                 throws IOException
Writes an IlvGraphicEnumeration field. IlvGraphic instances for which IlvGraphic.isPersistent() return false will not be saved.

Parameters:
field - The name of the field.
objs - The value of the field.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        IlvGraphicEnumeration objs,
                        boolean filter)
                 throws IOException
Writes an IlvGraphicEnumeration field.

Parameters:
field - The name of the field.
objs - The value of the field.
filter - If true then the filterObjects method is called to filter the objects.
Throws:
IOException - usual IO errors.

write

public final void write(String field,
                        Object[] objs,
                        String spec)
                 throws IOException
Writes a nested Object[] field. The specification indicates which objects can be found in the field.

Example specification: "(i)*sst"

In this example, the input array must consist of 4 entries. The first entry is an array of Integer objects. The second entry is a string. The third array is a string that acts as type indicator for the forth entry. The forth entry is written in a way according to the type indicator, i.e. if the type indicator is "i", then the forth entry is written as integer.

Brackets indicate nestings. Example: "((i)*sst)*"

In this example, the input array must consist of arrays. Each of the subarrays is organized as in the first example. The "*" indicated the that (i) array is repetitive, i.e. contains multiple integers.

The type indicators:

Parameters:
field - The name of the field.
objs - The value of the field.
spec - The specification of the types in the value array.
Throws:
IOException - usual IO errors.
Since:
JViews 8.0

flush

public final void flush()
                 throws IOException
Flushes the underlying output stream.

Throws:
IOException

writeExtensions

protected void writeExtensions(boolean copypaste)
                        throws IOException
Writes additional information to an IlvOutputStream. This method is called by the write(IlvManager manager) method after the manager has been completely saved.

Parameters:
copypaste - true if this stream is used for a copy/paste operation.
Throws:
IOException - usual IO errors.

write

protected void write(IlvGraphic obj)
              throws IOException
Writes an IlvGraphic. This method is used internally by other ILOG JViews packages. It should not be redefined by end users.

Throws:
IOException

filterObjects

protected IlvGraphicEnumeration filterObjects(IlvGraphicEnumeration objs,
                                              boolean copypaste)
Allows subclasses of IlvOutputStream to filter the graphic objects that will be actually saved to the file.

Parameters:
objs - An enumeration of graphic objects contained in the manager.
copypaste - true if this stream is used for a copy/paste operation.
Returns:
The enumeration of objects that will be actually saved to the file.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.