Class Image
java.lang.Object
pro.verron.officestamper.preset.Image
This class describes an image, which will be inserted into a document.
- Since:
- 1.0.0
- Author:
- Joseph Verron, Romster
-
Constructor Summary
ConstructorsConstructorDescriptionImage(byte[] imageBytes) Constructor for Image.Constructor for Image.Constructor for Image.Image(InputStream source) Constructor for Image.Image(InputStream source, @Nullable Integer maxWidth) Constructor for Image.Image(InputStream source, @Nullable Integer maxWidth, String filenameHint, String altText) Constructor for Image. -
Method Summary
Modifier and TypeMethodDescriptionReturns the alternative text for the image.byte[]getBytes()Returns the byte content of the image.Returns the filename hint for the image.Returns the maximum width of the image in twip, if specified.
-
Constructor Details
-
Image
Constructor for Image.- Parameters:
source-- content of the image as InputStream
- Throws:
IOException- if any.
-
Image
Constructor for Image.- Parameters:
source- content of the image as InputStreammaxWidth- max width of the image in twip
-
Image
Constructor for Image.- Parameters:
source- content of the image as InputStreammaxWidth- max width of the image in twipfilenameHint- filename hint for the image.altText- alternative text for the image.
-
Image
public Image(byte[] imageBytes) Constructor for Image.- Parameters:
imageBytes-- content of the image as an array of the bytes
-
Image
Constructor for Image.- Parameters:
imageBytes-- content of the image as an array of the bytes
maxWidth-- max width of the image in twip
-
Image
Constructor for Image.- Parameters:
imageBytes- content of the image as an array of the bytesmaxWidth- max width of the image in twipfilenameHint- filename hint for the image.altText- alternative text for the image.
-
-
Method Details
-
getBytes
public byte[] getBytes()Returns the byte content of the image.
The bytes are lazily cached from the source
InputStreamon first access. Subsequent calls return the cached bytes without re-reading the stream.- Returns:
- the byte content of the image
- Throws:
OfficeStamperException- if the image bytes cannot be read from the source stream
-
getAltText
Returns the alternative text for the image.- Returns:
- the alternative text
-
getFilenameHint
-
getMaxWidth
-