[]
An ImageSource stores image data together with its ImageType so it can be supplied to APIs that accept image content. Use getStream() to retrieve the image data as a stream and getType() to retrieve the image format.
ImageSource imageSource = new ImageSource(createImageStream(), ImageType.PNG);
worksheet.getOutlineColumn().setCollapseIndicator(imageSource);
InputStream stream = imageSource.getStream();
ImageSource(InputStream stream,
ImageType type) If stream is not null, this constructor reads the stream content and stores it in the image source. The specified type is assigned even when stream is null.
byte[] imageBytes = new byte[] {(byte) 137, 80, 78, 71, 13, 10, 26, 10};
ImageSource imageSource = new ImageSource(
new ByteArrayInputStream(imageBytes),
ImageType.PNG);
stream - The image stream. If null, no image content is loaded.type - The type of the image.Returns a new stream over the stored image bytes when this instance contains image data. If no image data is available, this method returns null.
byte[] imageBytes = new byte[] {(byte) 137, 80, 78, 71, 13, 10, 26, 10};
ImageSource imageSource = new ImageSource(new ByteArrayInputStream(imageBytes), ImageType.PNG);
imageSource.getStream();
null if this image source does not contain image data.Returns the ImageType that was assigned when this image source was created.
byte[] imageBytes = new byte[] {(byte) 137, 80, 78, 71, 13, 10, 26, 10};
ImageSource imageSource = new ImageSource(
new ByteArrayInputStream(imageBytes),
ImageType.PNG);
ImageType type = imageSource.getType();
null if no image type was assigned.