public class IlvOutputStream extends Object
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.Constructor and Description |
---|
IlvOutputStream(OutputStream stream)
Creates an
IlvOutputStream from an OutputStream. |
IlvOutputStream(OutputStream stream,
boolean binary)
Creates an
IlvOutputStream from an OutputStream. |
Modifier and Type | Method and Description |
---|---|
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,
ComponentOrientation v)
Writes a single AWT ComponentOrientation 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,
Locale v)
Writes a single Locale 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,
Paint paint,
Color defaultColor)
Writes a paint 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. |
void |
write(String field,
com.ibm.icu.util.ULocale v)
Writes a single ULocale field.
|
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 |
public IlvOutputStream(OutputStream stream)
IlvOutputStream
from an OutputStream.
This stream is in ASCII mode.stream
- The output stream.public IlvOutputStream(OutputStream stream, boolean binary)
IlvOutputStream
from an OutputStream.stream
- The output stream.binary
- If true
, the stream will contain binary data.public final void setBinary()
public final boolean getBinary()
IlvOutputStream
.setBinary()
public void write(IlvManager manager, boolean writeSelection) throws IOException
IlvOutputStream
.
You should not use this method; this method is public
for implementation purposes.manager
- The manager to save.writeSelection
- If true
then saves only selected objects
but does not save layer information.IOException
- usual IO errors.public void write(IlvManager manager) throws IOException
IlvOutputStream
.manager
- The manager to save.IOException
- usual IO errors.public final IlvManager getManager()
public void write(IlvManagerLayer[] layers, boolean useCopyPaste) throws IOException
IlvManager.write(String filename)
.IOException
public final void write(String field, boolean v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, boolean[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, short v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, short[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, int v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, int[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, long v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, long[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, float v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, float[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, double v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, double[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, String v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, String[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvRect v) throws IOException
IlvRect
field.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvRect[] v) throws IOException
IlvRect
field.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvPoint v) throws IOException
IlvPoint
field.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvPoint[] v) throws IOException
IlvPoint
field.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvTransformer v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvTransformer[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, Font v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, Font[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, Color v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, Color[] v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String pathfield, String rulefield, Shape shape) throws IOException
Shape
object.pathfield
- The name of the path field.rulefield
- The name of the winding rule field.shape
- The Shape
to write.IOException
public final void write(String field, GradientPaint v) throws IOException
java.awt.GradientPaint
.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.@Deprecated public final void writeGradient(String field, GradientPaint v) throws IOException
write
method.java.awt.GradientPaint
.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvPattern v) throws IOException
IlvPattern
instance.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.IlvPattern
@Deprecated public final void writePattern(String field, IlvPattern v) throws IOException
write
method.IlvPattern
instance.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.IlvPattern
public final void write(String field, IlvTexture v) throws IOException
IlvTexture
instance.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.IlvTexture
@Deprecated public final void writeTexture(String field, IlvTexture v) throws IOException
write
methodIlvTexture
instance.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.IlvTexture
public final void write(String field, Paint paint, Color defaultColor) throws IOException
IlvPersistentObject
,java.awt.Color
,java.awt.GradientPaint
,IlvPattern
paint,IlvTexture
paint,IlvLinearGradientPaint
,IlvRadialGradientPaint
,IlvBlinkingPaint
,IlvBlinkingMultiPaint
,java.awt.LinearGradientPaint
and
java.awt.RadialGradientPaint
are currently not supported.
Use
IlvLinearGradientPaint
and
IlvRadialGradientPaint
instead.field
- The name of the field.paint
- The paint of the field.defaultColor
- A color that is used as fallback if the paint is
null
or the paint is not of on of those types that can be
stored in the stream.IOException
- usual IO errors.public final void write(String field, BasicStroke v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.@Deprecated public final void writeStroke(String field, BasicStroke v) throws IOException
write
method.field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, ComponentOrientation v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, Locale v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, com.ibm.icu.util.ULocale v) throws IOException
field
- The name of the field.v
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvPersistentObject obj) throws IOException
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.field
- The name of the field.obj
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvPersistentObject[] objs) throws IOException
IlvPersistentObject[]
field.field
- The name of the field.objs
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvPersistentObject[] objs, int start, int end) throws IOException
IlvPersistentObject[]
field.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.IOException
- usual IO errors.public final void write(String field, Enumeration<?> objs) throws IOException
IlvPersistentObject
field.field
- The name of the field.objs
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvGraphic obj) throws IOException
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.field
- The name of the field.obj
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvGraphic[] objs) throws IOException
IlvGraphic[]
field. IlvGraphic
instances for which IlvGraphic.isPersistent()
return
false
will not be saved.field
- The name of the field.objs
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvGraphic[] objs, int start, int end) throws IOException
IlvGraphic[]
field.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.IOException
- usual IO errors.public final void write(String field, IlvGraphicEnumeration objs) throws IOException
IlvGraphicEnumeration
field. IlvGraphic
instances for which IlvGraphic.isPersistent()
return
false
will not be saved.field
- The name of the field.objs
- The value of the field.IOException
- usual IO errors.public final void write(String field, IlvGraphicEnumeration objs, boolean filter) throws IOException
IlvGraphicEnumeration
field.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.IOException
- usual IO errors.public final void write(String field, Object[] objs, String spec) throws IOException
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:
field
- The name of the field.objs
- The value of the field.spec
- The specification of the types in the value array.IOException
- usual IO errors.public final void flush() throws IOException
IOException
protected void writeExtensions(boolean copypaste) throws IOException
IlvOutputStream
.
This method is called by the write(IlvManager manager)
method
after the manager has been completely saved.copypaste
- true
if this stream is used for a copy/paste operation.IOException
- usual IO errors.protected void write(IlvGraphic obj) throws IOException
IlvGraphic
. This method is used internally by other
Perforce JViews packages. It should not be redefined by end users.IOException
protected IlvGraphicEnumeration filterObjects(IlvGraphicEnumeration objs, boolean copypaste)
IlvOutputStream
to filter the
graphic objects that will be actually saved to the file.objs
- An enumeration of graphic objects contained in the manager.copypaste
- true
if this stream is used for a copy/paste operation.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.