Class BinaryGraphicsDocument

java.lang.Object
writer2latex.base.BinaryGraphicsDocument
All Implemented Interfaces:
OutputFile

public class BinaryGraphicsDocument extends 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).
  • Constructor Details

    • BinaryGraphicsDocument

      public BinaryGraphicsDocument(String sFileName, 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 Details

    • 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(OutputStream os) throws 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:
      IOException - If any I/O error occurs.
    • getFileName

      public String getFileName()
      Get the document name or URL

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

      public 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