public abstract class AbstractConversionImageHandler extends Object implements ConversionImageHandler
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
handledImagesMap |
protected String |
imageDirPath |
protected boolean |
includeUUID |
protected static org.slf4j.Logger |
log |
protected String |
uuid |
Modifier | Constructor and Description |
---|---|
protected |
AbstractConversionImageHandler(String imageDirPath,
boolean includeUUID)
Creates an AbstractConversionImageHandler
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
If the instance is reused, it should be cleared first
|
protected String |
createEncodedImage(BinaryPart binaryPart,
byte[] bytes) |
protected String |
createKey(Relationship relationship,
BinaryPart part) |
protected abstract String |
createStoredImage(BinaryPart binaryPart,
byte[] bytes) |
protected String |
doHandleImage(AbstractWordXmlPicture picture,
Relationship relationship,
BinaryPart part) |
protected byte[] |
getImageData(BinaryPart binaryPart)
Get the image data of the buffer
|
protected String |
getImageName(BinaryPart binaryPart)
Get the image base name
|
protected String |
handleExternalImage(AbstractWordXmlPicture picture,
Relationship relationship,
BinaryPart part) |
String |
handleImage(AbstractWordXmlPicture picture,
Relationship relationship,
BinaryPart part) |
protected String |
handleInternalImage(AbstractWordXmlPicture picture,
Relationship relationship,
BinaryPart binaryPart) |
protected boolean |
isInternalImage(AbstractWordXmlPicture picture,
Relationship relationship,
BinaryPart part) |
protected String |
setupImageName(BinaryPart binaryPart) |
protected static org.slf4j.Logger log
protected String uuid
protected String imageDirPath
protected boolean includeUUID
protected AbstractConversionImageHandler(String imageDirPath, boolean includeUUID)
imageDirPath,
- the path, where the images will be storedincludeUUID,
- should the image names be prefixed with an UUID to differentiate different runspublic String handleImage(AbstractWordXmlPicture picture, Relationship relationship, BinaryPart part) throws Docx4JException
handleImage
in interface ConversionImageHandler
relationship
- of the imagepart
- of the image, if it is an internal image, otherwise nullDocx4JException
- this exception will be logged, but not propagatedprotected String createKey(Relationship relationship, BinaryPart part)
protected String doHandleImage(AbstractWordXmlPicture picture, Relationship relationship, BinaryPart part) throws Docx4JException
Docx4JException
protected boolean isInternalImage(AbstractWordXmlPicture picture, Relationship relationship, BinaryPart part) throws Docx4JException
Docx4JException
protected String handleInternalImage(AbstractWordXmlPicture picture, Relationship relationship, BinaryPart binaryPart) throws Docx4JException
picture
- relationship
- binaryPart
- Docx4JException
protected abstract String createStoredImage(BinaryPart binaryPart, byte[] bytes) throws Docx4JException
Docx4JException
protected String createEncodedImage(BinaryPart binaryPart, byte[] bytes) throws Docx4JException
Docx4JException
protected String setupImageName(BinaryPart binaryPart)
protected String getImageName(BinaryPart binaryPart)
binaryPart
- protected byte[] getImageData(BinaryPart binaryPart)
binaryPart
- protected String handleExternalImage(AbstractWordXmlPicture picture, Relationship relationship, BinaryPart part)
picture
- relationship
- part
- (is always null)public void clear()
Copyright © 2007-2019. All Rights Reserved.