java.lang.Object
org.docx4j.openpackaging.Base
org.docx4j.openpackaging.parts.Part
org.docx4j.openpackaging.parts.WordprocessingML.BinaryPart
Direct Known Subclasses:
AbstractFontPart, AlternativeFormatInputPart, BinaryPartAbstractImage, EmbeddedPackagePart, FontDataPart, OleObjectBinaryPart, PrinterSettings, VMLBinaryPart

public class BinaryPart
extends Part
A part containing binary (as opposed to XML) data. The content of a binary parts is loaded lazily (ie only when required).
  • Field Details

    • log

      protected static org.slf4j.Logger log
  • Constructor Details

  • Method Details

    • getExternalTarget

      public ExternalTarget getExternalTarget()
    • setBinaryData

      public void setBinaryData​(java.io.InputStream binaryData)
    • setBinaryData

      public void setBinaryData​(byte[] bytes)
    • setBinaryData

      public void setBinaryData​(java.nio.ByteBuffer bb)
    • isLoaded

      public boolean isLoaded()
      Since:
      3.0
    • getBuffer

      public java.nio.ByteBuffer getBuffer()
      Get the contents of this part. NB: if you are moving this part from one pkg to another, you'll probably want to invoke this first, since otherwise the content may not be located (lazy loading).
      Returns:
    • writeDataToOutputStream

      public void writeDataToOutputStream​(java.io.OutputStream out) throws java.io.IOException
      Copy the ByteBuffer containing this part's binary data to an output stream.
      Parameters:
      out -
      Throws:
      java.io.IOException
    • getBytes

      public byte[] getBytes()
    • isContentEqual

      public boolean isContentEqual​(Part other) throws Docx4JException
      Specified by:
      isContentEqual in class Part
      Throws:
      Docx4JException