Package org.htmlunit.platform.image
Class ImageIOImageData
- java.lang.Object
-
- org.htmlunit.platform.image.ImageIOImageData
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,ImageData
public class ImageIOImageData extends java.lang.Object implements ImageData
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Wraps the ImageReader for an HtmlImage. This is necessary because an object with a finalize() method is only garbage collected after the method has been run. Which causes all referenced objects to also not be garbage collected until this happens. Because a HtmlImage references a lot of objects which could all be garbage collected without impacting the ImageReader it is better to wrap it in another class.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.imageio.ImageReader
imageReader_
-
Constructor Summary
Constructors Constructor Description ImageIOImageData(java.io.InputStream inputStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
protected void
finalize()
javax.imageio.ImageReader
getImageReader()
IntDimension2D
getWidthHeight()
-
-
-
Method Detail
-
getImageReader
public javax.imageio.ImageReader getImageReader()
- Returns:
- the
ImageReader
-
getWidthHeight
public IntDimension2D getWidthHeight() throws java.io.IOException
- Specified by:
getWidthHeight
in interfaceImageData
- Throws:
java.io.IOException
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.io.IOException
-
-