Class BinaryPart
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
A part containing binary (as opposed to XML) data.
The content of a binary parts is loaded lazily (ie only when required).
-
Field Summary
FieldsFields inherited from class org.docx4j.openpackaging.Base
contentType, partName, relationships -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the contents of this part.byte[]getBytes()booleanisContentEqual(Part other) booleanisLoaded()voidsetBinaryData(byte[] bytes) voidsetBinaryData(InputStream binaryData) voidvoidCopy the ByteBuffer containing this part's binary data to an output stream.Methods inherited from class org.docx4j.openpackaging.parts.Part
getContentLengthAsLoaded, getOwningRelationshipPart, getPackage, getRelationshipType, getSourceRelationship, getSourceRelationships, getVersion, remove, rename, setContentLengthAsLoaded, setOwningRelationshipPart, setPackage, setPartShortcut, setRelationshipType, setSourceRelationship, setVersionMethods inherited from class org.docx4j.openpackaging.Base
addTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, reset, setContentType, setPartName, setRelationships, setUserData
-
Field Details
-
log
protected static org.slf4j.Logger log
-
-
Constructor Details
-
BinaryPart
- Throws:
InvalidFormatException
-
BinaryPart
-
-
Method Details
-
getExternalTarget
-
setBinaryData
-
setBinaryData
public void setBinaryData(byte[] bytes) -
setBinaryData
-
isLoaded
public boolean isLoaded()- Since:
- 3.0
-
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
Copy the ByteBuffer containing this part's binary data to an output stream.- Parameters:
out-- Throws:
IOException
-
getBytes
public byte[] getBytes() -
isContentEqual
- Specified by:
isContentEqualin classPart- Throws:
Docx4JException
-