Class ImageBinary
- java.lang.Object
-
- org.hippoecm.frontend.plugins.gallery.imageutil.ImageBinary
-
- All Implemented Interfaces:
javax.jcr.Binary
public class ImageBinary extends Object implements javax.jcr.Binary
This class extends aBinary
class with extra information regarding images: filename, mimetype and color model. It uses the commons-imaging (formerly Sanselan) library to figure out the mimetype if none is provided. For SVG images (which Sanselan does not recognize) the mimetype auto-detection is skipped and the color model is set to UNKNOWN. Furthermore it converts YCCK and CMYK input into the RGB color model so it can be used by the JPEGImageReader. See CMS7-5074 for more info.
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description ImageBinary(javax.jcr.Node node, InputStream stream, String fileName)
ImageBinary(javax.jcr.Node parent, InputStream stream, String fileName, String mimeType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
ColorModel
getColorModel()
String
getFileName()
String
getMimeType()
long
getSize()
InputStream
getStream()
int
read(byte[] b, long position)
String
toString()
-
-
-
Constructor Detail
-
ImageBinary
public ImageBinary(javax.jcr.Node node, InputStream stream, String fileName) throws GalleryException
- Throws:
GalleryException
-
ImageBinary
public ImageBinary(javax.jcr.Node parent, InputStream stream, String fileName, String mimeType) throws GalleryException
- Throws:
GalleryException
-
-
Method Detail
-
getMimeType
public String getMimeType()
-
getFileName
public String getFileName()
-
getColorModel
public ColorModel getColorModel()
-
getStream
public InputStream getStream() throws javax.jcr.RepositoryException
- Specified by:
getStream
in interfacejavax.jcr.Binary
- Throws:
javax.jcr.RepositoryException
-
read
public int read(byte[] b, long position) throws IOException, javax.jcr.RepositoryException
- Specified by:
read
in interfacejavax.jcr.Binary
- Throws:
IOException
javax.jcr.RepositoryException
-
getSize
public long getSize() throws javax.jcr.RepositoryException
- Specified by:
getSize
in interfacejavax.jcr.Binary
- Throws:
javax.jcr.RepositoryException
-
dispose
public void dispose()
- Specified by:
dispose
in interfacejavax.jcr.Binary
-
-