public class IlvInputStream extends Object
IlvOutputStream
in order to be read.
Note that this format is different from the Perforce Views C++ format.
This class provides a wide range of methods that allow you to read the
fields of a graphic object.Constructor and Description |
---|
IlvInputStream(InputStream stream)
Creates an
IlvInputStream from an InputStream . |
Modifier and Type | Method and Description |
---|---|
URL |
getDocumentBase()
Returns the URL from which this stream is reading data,
or
null if this stream was created
directly from an InputStream . |
IlvGraphicBag |
getGraphicBag()
Returns the graphic bag.
|
IlvGraphicEnumeration |
getObjects()
Returns an enumeration of the graphic objects
that have been read.
|
float |
getVersion()
returns the version read from the InputStream
|
protected IlvPersistentObject |
invokeConstructor(Constructor<?> constructor)
Invokes the given
constructor . |
boolean |
isASCIIMode()
Returns whether the stream is in ASCII mode.
|
protected boolean |
isDoubleVersion()
returns true is the file is written with JViews 9.0 and later
|
void |
read(IlvGraphicBag bag)
Reads an
IlvInputStream . |
boolean |
readBoolean(String field)
Reads a field of type
boolean . |
boolean[] |
readBooleanArray(String field)
Reads a field of type
boolean[] . |
Color |
readColor(String field)
Reads a field of type
Color . |
Color[] |
readColorArray(String field)
Reads a field of type
Color[] . |
ComponentOrientation |
readComponentOrientation(String field)
Reads a single AWT ComponentOrientation field.
|
double |
readDouble(String field)
Reads a field of type
double . |
double[] |
readDoubleArray(String field)
Reads a field of type
double[] . |
double |
readDoubleOrFloat(String field)
Reads a field of type
double (or type float for version before 9.0). |
double[] |
readDoubleOrFloatArray(String field)
Reads a field of type
double[] (or type float for version before 9.0). |
protected void |
readExtensions()
This method allows subclasses of
IlvManager
or IlvGrapher to read
additional information saved (after the manager layers)
using the corresponding method writeExtensions of the
class IlvOutputStream . |
float |
readFloat(String field)
Reads a field of type
float . |
float[] |
readFloatArray(String field)
Reads a field of type
float[] . |
Font |
readFont(String field)
Reads a field of type
font . |
Font[] |
readFontArray(String field)
Reads a field of type
font[] . |
GradientPaint |
readGradient(String field)
Reads a single AWT gradient field.
|
int |
readInt(String field)
Reads a field of type
int . |
int[] |
readIntArray(String field)
Reads a field of type
int[] . |
Locale |
readLocale(String field)
Reads a single Locale field.
|
long |
readLong(String field)
Reads a field of type
long . |
long[] |
readLongArray(String field)
Reads a field of type
long[] . |
protected IlvGraphic |
readObject(boolean add,
int index)
Reads an
IlvGraphic . |
IlvGraphic |
readObject(String field)
Reads a field of type
IlvGraphic . |
Object[] |
readObjectArray(String field,
String spec)
Reads a field containing a nested
Object[] value. |
IlvGraphic[] |
readObjects(String field)
Reads a field of type
IlvGraphic[] . |
Paint |
readPaint(String field)
Reads a paint field.
|
IlvPattern |
readPattern(String field)
Reads a pattern field.
|
IlvPersistentObject |
readPersistentObject(String field)
Reads a field of type
IlvPersistentObject . |
IlvPersistentObject[] |
readPersistentObjects(String field)
Reads a field of type
IlvPersistentObject[] . |
IlvPoint |
readPoint(String field)
Reads a field of type
IlvPoint . |
IlvPoint[] |
readPointArray(String field)
Reads a field of type
IlvPoint[] . |
IlvRect |
readRect(String field)
Reads a field of type
IlvRect . |
IlvRect[] |
readRectArray(String field)
Reads a field of type
IlvRect[] . |
Shape |
readShape(String pathfield,
String rulefield)
Reads a Java 2D Shape object.
|
short |
readShort(String field)
Reads a field of type
short . |
short[] |
readShortArray(String field)
Reads a field of type
short[] . |
String |
readString(String field)
Reads a field of type
String . |
String[] |
readStringArray(String field)
Reads a field of type
String[] . |
BasicStroke |
readStroke(String field)
Reads a single AWT BasicStroke field.
|
IlvTexture |
readTexture(String field)
Reads a texture field.
|
IlvTransformer |
readTransformer(String field)
Reads a field of type
IlvTransformer . |
IlvTransformer[] |
readTransformerArray(String field)
Reads a field of type
IlvTransformer[] . |
com.ibm.icu.util.ULocale |
readULocale(String field)
Reads a single ULocale field.
|
void |
registerGraphic(IlvGraphic g)
Registers an
IlvGraphic that has been read. |
void |
setCopyPasteMode()
Sets this
IlvInputStream in a copy/paste
mode. |
void |
setDocumentBase(URL url)
Sets the base URL for this
IlvInputStream . |
void |
setVersion(float version) |
public IlvInputStream(InputStream stream)
IlvInputStream
from an InputStream
.public boolean isASCIIMode()
public void setDocumentBase(URL url)
IlvInputStream
.
You should not call this method.
This method is public for implementation purposes.public URL getDocumentBase()
null
if this stream was created
directly from an InputStream
.public void read(IlvGraphicBag bag) throws IOException, IlvReadFileException
IlvInputStream
.bag
- The graphic bag in which objects will be added.IOException
- if there are any I/O errors.IlvReadFileException
- if the format is not correct or if
some classes cannot be loaded.public final IlvGraphicBag getGraphicBag()
read
method.public void setCopyPasteMode()
IlvInputStream
in a copy/paste
mode.
You should not use this method. The method is
public for implementation purposes.public IlvGraphicEnumeration getObjects()
public void registerGraphic(IlvGraphic g)
IlvGraphic
that has been read.
You should not use this method. The method is
public for implementation purposes.protected IlvPersistentObject invokeConstructor(Constructor<?> constructor) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
constructor
.
This method is called to create every object read from the input
stream. It can be overridden in subclasses of IlvInputStream
defined in other packages to create private objects defined in these
packages.
constructor
- The constructor to invoke.InstantiationException
- if the class that
declares the underlying constructor represents an abstract class.IllegalAccessException
- if the underlying
constructor is inaccessible.IllegalArgumentException
- if the number of actual
and formal parameters differ, or if an unwrapping conversion fails.InvocationTargetException
- if the underlying
constructor throws an exception.Constructor.newInstance(java.lang.Object...)
protected IlvGraphic readObject(boolean add, int index) throws IOException, IlvReadFileException
IlvGraphic
. This method is used internally by other
Perforce JViews packages. It should not be redefined by end users.IlvReadFileException
- if the format is not correct.IOException
- standard IO errors.public final boolean readBoolean(String field) throws IlvReadFileException
boolean
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or the
field is not a boolean. If the field is not present, then an
IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final boolean[] readBooleanArray(String field) throws IlvReadFileException
boolean[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final short readShort(String field) throws IlvReadFileException
short
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final short[] readShortArray(String field) throws IlvReadFileException
short[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final int readInt(String field) throws IlvReadFileException
int
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final int[] readIntArray(String field) throws IlvReadFileException
int[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final long readLong(String field) throws IlvReadFileException
long
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final long[] readLongArray(String field) throws IlvReadFileException
long[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final float readFloat(String field) throws IlvReadFileException
float
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final float[] readFloatArray(String field) throws IlvReadFileException
float[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final double readDouble(String field) throws IlvReadFileException
double
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final double[] readDoubleArray(String field) throws IlvReadFileException
double[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final double readDoubleOrFloat(String field) throws IlvReadFileException
double
(or type float
for version before 9.0).field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final double[] readDoubleOrFloatArray(String field) throws IlvReadFileException
double[]
(or type float
for version before 9.0).field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final String readString(String field) throws IlvReadFileException
String
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final String[] readStringArray(String field) throws IlvReadFileException
String[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvPoint readPoint(String field) throws IlvReadFileException
IlvPoint
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvPoint[] readPointArray(String field) throws IlvReadFileException
IlvPoint[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvRect readRect(String field) throws IlvReadFileException
IlvRect
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvRect[] readRectArray(String field) throws IlvReadFileException
IlvRect[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvTransformer readTransformer(String field) throws IlvReadFileException
IlvTransformer
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvTransformer[] readTransformerArray(String field) throws IlvReadFileException
IlvTransformer[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Color readColor(String field) throws IlvReadFileException
Color
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Color[] readColorArray(String field) throws IlvReadFileException
Color[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Font readFont(String field) throws IlvReadFileException
font
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Font[] readFontArray(String field) throws IlvReadFileException
font[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Shape readShape(String pathfield, String rulefield) throws IlvReadFileException
pathfield
- The name of the path field.rulefield
- The name of the winding rule field.IlvReadFileException
public final GradientPaint readGradient(String field) throws IlvReadFileException
field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvPattern readPattern(String field) throws IlvReadFileException
IlvPattern
object from the file.field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.IlvPattern
public final IlvTexture readTexture(String field) throws IlvReadFileException
IlvTexture
object from the file.field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.IlvTexture
public final Paint readPaint(String field) throws IlvReadFileException
Paint
object from the file.
Only those paint objects can be stored in a file:
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.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final BasicStroke readStroke(String field) throws IlvReadFileException
field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final ComponentOrientation readComponentOrientation(String field) throws IlvReadFileException
field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Locale readLocale(String field) throws IlvReadFileException
field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final com.ibm.icu.util.ULocale readULocale(String field) throws IlvReadFileException
field
- The name of the field.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvGraphic readObject(String field) throws IlvReadFileException
IlvGraphic
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvGraphic[] readObjects(String field) throws IlvReadFileException
IlvGraphic[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvPersistentObject readPersistentObject(String field) throws IlvReadFileException
IlvPersistentObject
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final IlvPersistentObject[] readPersistentObjects(String field) throws IlvReadFileException
IlvPersistentObject[]
.field
- The name of the field to be read.IlvReadFileException
- if the field is not present or if the
field does not have the correct type. If the field is not present, then
an IlvFieldNotFoundException
is launched.
This allows optional fields to be detected.public final Object[] readObjectArray(String field, String spec) throws IlvReadFileException
Object[]
value.
The specification indicates which objects can be found in the array,
and is used to perform a type check during reading.
Example specification: "(i)*sst"
In this example, it reads 4 entries and returns an array of four. 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 an object whose type is according to the type indicator, that is, if the type indicator is "i", then the forth entry is an Integer object.
Brackets indicate nestings. Example: "((i)*sst)*"
In this example, the returned array consists of subarrays. Each subarray is organized as in the first example. The "*" indicates the that (i) array is repetitive, that is, contains multiple integers.
The type indicators:
field
- The name of the field to be read.spec
- The specification of the types in the returned array.IlvReadFileException
- if the field is not present or if the
content of the field does not match the type specification. If the
field is not present, then an IlvFieldNotFoundException
is
launched.
This allows optional fields to be detected.protected void readExtensions() throws IlvReadFileException
IlvManager
or IlvGrapher
to read
additional information saved (after the manager layers)
using the corresponding method writeExtensions
of the
class IlvOutputStream
.IlvReadFileException
- if the format is not correct.public final float getVersion()
public final void setVersion(float version)
protected boolean isDoubleVersion()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.