Class ImageRawStream
java.lang.Object
org.apache.xmlgraphics.image.loader.impl.AbstractImage
org.apache.xmlgraphics.image.loader.impl.ImageRawStream
- All Implemented Interfaces:
Image
- Direct Known Subclasses:
ImageRawCCITTFax
,ImageRawEPS
,ImageRawJPEG
,ImageRawPNG
This class is an implementation of the Image interface exposing an InputStream for loading the
raw/undecoded image.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
InputStream factory that wraps a byte array.static interface
Represents a factory for InputStream objects. -
Constructor Summary
ConstructorsConstructorDescriptionImageRawStream
(ImageInfo info, ImageFlavor flavor, InputStream in) Constructor for a simple InputStream as parameter.ImageRawStream
(ImageInfo info, ImageFlavor flavor, ImageRawStream.InputStreamFactory streamFactory) Main constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns a new InputStream to access the raw image.Returns the flavor of the image.Returns the MIME type of the stream data.boolean
Indicates whether the Image instance is cacheable in memory.void
Sets the InputStreamFactory to be used by this image.void
writeTo
(OutputStream out) Writes the content of the image to an OutputStream.Methods inherited from class org.apache.xmlgraphics.image.loader.impl.AbstractImage
getColorSpace, getICCProfile, getInfo, getSize, toString
-
Constructor Details
-
ImageRawStream
public ImageRawStream(ImageInfo info, ImageFlavor flavor, ImageRawStream.InputStreamFactory streamFactory) Main constructor.- Parameters:
info
- the image info objectflavor
- the image flavor for the raw imagestreamFactory
- the InputStreamFactory that is used to create InputStream instances
-
ImageRawStream
Constructor for a simple InputStream as parameter.- Parameters:
info
- the image info objectflavor
- the image flavor for the raw imagein
- the InputStream with the raw content
-
-
Method Details
-
getFlavor
Returns the flavor of the image.- Returns:
- the image flavor
-
getMimeType
Returns the MIME type of the stream data.- Returns:
- the MIME type
-
isCacheable
public boolean isCacheable()Indicates whether the Image instance is cacheable in memory.- Returns:
- true if the Image is cacheable
-
setInputStreamFactory
Sets the InputStreamFactory to be used by this image. This method allows to replace the original factory.- Parameters:
factory
- the new InputStreamFactory
-
createInputStream
Returns a new InputStream to access the raw image.- Returns:
- the InputStream
-
writeTo
Writes the content of the image to an OutputStream. The OutputStream in NOT closed at the end.- Parameters:
out
- the OutputStream- Throws:
IOException
- if an I/O error occurs
-