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

      public abstract class AbstractAFPObject
      extends java.lang.Object
      implements Streamable

  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

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `AbstractAFPObject.Category` structured field category codes
    `static interface` | `AbstractAFPObject.Type` structured field type codes

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.apache.commons.logging.Log` | `LOG` Static logging instance
    `protected static byte` | `SF_CLASS` the structured field class id
    `protected static int` | `SF_HEADER_LENGTH` Length of bytes of a Structured Field Header

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAFPObject()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `copySF(byte[] data, byte type, byte category)` Copies the template structured field data array to the given byte array
    `protected static void` | `copySF(byte[] data, byte clazz, byte type, byte category)` Copies the template structured field data array to the given byte array
    `protected static java.lang.String` | `truncate(java.lang.String str, int maxLength)` Truncates the string as necessary
    `protected static void` | `writeChunksToStream(byte[] data, byte[] dataHeader, int lengthOffset, int maxChunkLength, java.io.OutputStream os)` Writes data chunks to a given outputstream
    `protected <S extends Streamable> void` | `writeObjects(java.util.Collection<S> objects, java.io.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 Detail

    - #### LOG

          protected static final org.apache.commons.logging.Log LOG

      Static logging instance

    - #### SF_CLASS

          protected static final byte SF_CLASS

      the structured field class id
      See Also:
        Constant Field Values

    - #### SF_HEADER_LENGTH

          protected static final int SF_HEADER_LENGTH

      Length of bytes of a Structured Field Header

  - ### Constructor Detail

    - #### AbstractAFPObject

          public AbstractAFPObject()

  - ### Method Detail

    - #### 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 array
        `type` - the type code
        `category` - 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 array
        `clazz` - the class code
        `type` - the type code
        `category` - the category code

    - #### writeObjects

          protected <S extends Streamable> void writeObjects(java.util.Collection<S> objects,
                                                             java.io.OutputStream os)
                                                      throws java.io.IOException

      Writes a collection of Streamable to the AFP Datastream.
      Type Parameters:
        `S` - Streamable view of an AFPObject
      Parameters:
        `objects` - a list of AFPObjects
        `os` - The stream to write to
      Throws:
        `java.io.IOException` - an I/O exception of some sort has occurred.

    - #### writeChunksToStream

          protected static void writeChunksToStream(byte[] data,
                                                    byte[] dataHeader,
                                                    int lengthOffset,
                                                    int maxChunkLength,
                                                    java.io.OutputStream os)
                                             throws java.io.IOException

      Writes data chunks to a given outputstream
      Parameters:
        `data` - the data byte array
        `dataHeader` - the header data
        `lengthOffset` - offset of length field in data chunk
        `maxChunkLength` - the maximum chunk length
        `os` - the outputstream to write to
      Throws:
        `java.io.IOException` - thrown if an I/O exception of some sort has occurred.

    - #### truncate

          protected static java.lang.String truncate(java.lang.String str,
                                                     int maxLength)

      Truncates the string as necessary
      Parameters:
        `str` - a character string
        `maxLength` - the maximum length allowed for the string
      Returns:
        a possibly truncated string

Copyright 1999-2020 The Apache Software Foundation. All Rights Reserved.