Package org.apache.fop.afp.modca
Class AbstractAFPObject
java.lang.Object
org.apache.fop.afp.modca.AbstractAFPObject
- All Implemented Interfaces:
Streamable
- Direct Known Subclasses:
AbstractGraphicsDrawingOrder
,AbstractStructuredObject
,AbstractTriplet
,BandImage
,ImageCellPosition
,ImageInputDescriptor
,ImageOutputControl
,ImageRasterData
,ImageSizeParameter
,MapPageOverlay
,MapPageSegment
,NoOperation
,ObjectAreaPosition
,PresentationTextData
,TilePosition
,TileSize
,TileTOC
,TransparencyMask
This is the base class for all data stream objects. Page objects are
responsible for building and generating the binary datastream in an
AFP format.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
structured field category codesstatic interface
structured field type codes -
Field Summary
Modifier and TypeFieldDescriptionprotected static final org.apache.commons.logging.Log
Static logging instanceprotected static final byte
the structured field class idprotected static final int
Length of bytes of a Structured Field Header -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
copySF
(byte[] data, byte type, byte category) Copies the template structured field data array to the given byte arrayprotected static void
copySF
(byte[] data, byte clazz, byte type, byte category) Copies the template structured field data array to the given byte arrayprotected static String
Truncates the string as necessaryprotected static void
writeChunksToStream
(byte[] data, byte[] dataHeader, int lengthOffset, int maxChunkLength, OutputStream os) Writes data chunks to a given outputstreamprotected <S extends Streamable>
voidwriteObjects
(Collection<S> objects, OutputStream os) Writes a collection of Streamable to the AFP Datastream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.fop.afp.Streamable
writeToStream
-
Field Details
-
LOG
protected static final org.apache.commons.logging.Log LOGStatic logging instance -
SF_CLASS
protected static final byte SF_CLASSthe structured field class id- See Also:
-
SF_HEADER_LENGTH
protected static final int SF_HEADER_LENGTHLength of bytes of a Structured Field Header
-
-
Constructor Details
-
AbstractAFPObject
public AbstractAFPObject()
-
-
Method Details
-
copySF
protected void copySF(byte[] data, byte type, byte category) Copies the template structured field data array to the given byte array- Parameters:
data
- the structured field data byte arraytype
- the type codecategory
- the category code
-
copySF
protected static void copySF(byte[] data, byte clazz, byte type, byte category) Copies the template structured field data array to the given byte array- Parameters:
data
- the structured field data byte arrayclazz
- the class codetype
- the type codecategory
- the category code
-
writeObjects
protected <S extends Streamable> void writeObjects(Collection<S> objects, OutputStream os) throws IOException Writes a collection of Streamable to the AFP Datastream.- Type Parameters:
S
- Streamable view of an AFPObject- Parameters:
objects
- a list of AFPObjectsos
- The stream to write to- Throws:
IOException
- an I/O exception of some sort has occurred.
-
writeChunksToStream
protected static void writeChunksToStream(byte[] data, byte[] dataHeader, int lengthOffset, int maxChunkLength, OutputStream os) throws IOException Writes data chunks to a given outputstream- Parameters:
data
- the data byte arraydataHeader
- the header datalengthOffset
- offset of length field in data chunkmaxChunkLength
- the maximum chunk lengthos
- the outputstream to write to- Throws:
IOException
- thrown if an I/O exception of some sort has occurred.
-
truncate
Truncates the string as necessary- Parameters:
str
- a character stringmaxLength
- the maximum length allowed for the string- Returns:
- a possibly truncated string
-