Class BinaryGraphicsDocument

  • All Implemented Interfaces:
    OutputFile

    public class BinaryGraphicsDocument
    extends java.lang.Object
    implements OutputFile
    This class is used to represent a binary graphics document to be included in the converter result. I may also represent a linked image, which should not be included (and will produce an empty file if it is).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getData()
      Get the data of the image
      java.lang.String getFileName()
      Get the document name or URL
      java.lang.String getMIMEType()
      Get the MIME type of the document.
      boolean isAcceptedFormat()
      Is this image in an acceptable format for the converter?
      boolean isLinked()
      Does this BinaryGraphicsDocument represent a linked image?
      boolean isMasterDocument()
      Is this document a master document?
      boolean isRecycled()
      Is this graphics document recycled?
      void setData​(byte[] data, boolean bIsAcceptedFormat)
      Set image contents to a byte array
      void setData​(byte[] data, int nOff, int nLen, boolean bIsAcceptedFormat)
      Set image contents to part of a byte array
      void write​(java.io.OutputStream os)
      Writes out the content to the specified OutputStream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BinaryGraphicsDocument

        public BinaryGraphicsDocument​(java.lang.String sFileName,
                                      java.lang.String sMimeType)
        Constructs a new graphics document. Until data is added using the read methods, the document is considered a link to the image given by the file name.
        Parameters:
        sFileName - The name or URL of the GraphicsDocument.
        sMimeType - the MIME type of the document
      • BinaryGraphicsDocument

        public BinaryGraphicsDocument​(BinaryGraphicsDocument bgd)
        Construct a new graphics document which is a recycled version of the supplied one. This implies that all information is identical, but the recycled version does not contain any data. This is for images that are used more than once in the document.
        Parameters:
        bgd - the source document
    • Method Detail

      • isRecycled

        public boolean isRecycled()
        Is this graphics document recycled?
        Returns:
        true if this is the case
      • setData

        public void setData​(byte[] data,
                            boolean bIsAcceptedFormat)
        Set image contents to a byte array
        Parameters:
        data - the image data
        bIsAcceptedFormat - flag to indicate that the format of the image is acceptable for the converter
      • setData

        public void setData​(byte[] data,
                            int nOff,
                            int nLen,
                            boolean bIsAcceptedFormat)
        Set image contents to part of a byte array
        Parameters:
        data - the image data
        nOff - the offset into the byte array
        nLen - the number of bytes to use
        bIsAcceptedFormat - flag to indicate that the format of the image is acceptable for the converter
      • isLinked

        public boolean isLinked()
        Does this BinaryGraphicsDocument represent a linked image?
        Returns:
        true if so
      • isAcceptedFormat

        public boolean isAcceptedFormat()
        Is this image in an acceptable format for the converter?
        Returns:
        true if so (always returns false for linked images)
      • getData

        public byte[] getData()
        Get the data of the image
        Returns:
        the image data as a byte array - or null if this is a linked image
      • write

        public void write​(java.io.OutputStream os)
                   throws java.io.IOException
        Writes out the content to the specified OutputStream. Linked images will not write any data.
        Specified by:
        write in interface OutputFile
        Parameters:
        os - OutputStream to write out the content.
        Throws:
        java.io.IOException - If any I/O error occurs.
      • getFileName

        public java.lang.String getFileName()
        Get the document name or URL

        Specified by:
        getFileName in interface OutputFile
        Returns:
        The document name or URL
      • getMIMEType

        public java.lang.String getMIMEType()
        Get the MIME type of the document.
        Specified by:
        getMIMEType in interface OutputFile
        Returns:
        The MIME type or null if this is unknown
      • isMasterDocument

        public boolean isMasterDocument()
        Is this document a master document?
        Specified by:
        isMasterDocument in interface OutputFile
        Returns:
        false - a graphics file is never a master document