Class InputStreamImageSource
- java.lang.Object
-
- net.coobird.thumbnailator.tasks.io.AbstractImageSource<java.io.InputStream>
-
- net.coobird.thumbnailator.tasks.io.InputStreamImageSource
-
- All Implemented Interfaces:
ImageSource<java.io.InputStream>
public class InputStreamImageSource extends AbstractImageSource<java.io.InputStream>
AnImageSourcewhich uses anInputStreamto read the source image.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classInputStreamImageSource.ExifCaptureInputStreamAnInputStreamwhich intercepts the data stream to find Exif data and captures it if present.
-
Field Summary
Fields Modifier and Type Field Description private static intFIRST_IMAGE_INDEXThe index used to obtain the first image in an image file.private java.io.InputStreamisAInputStreamfrom which the source image is to be read.-
Fields inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSource
hasReadInput, inputFormatName, param
-
-
Constructor Summary
Constructors Constructor Description InputStreamImageSource(java.io.InputStream is)Instantiates anInputStreamImageSourcewith theInputStreamwhich will be used to read the source image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.RectanglecalculateSourceRegion(int width, int height, Orientation orientation, Region region)java.io.InputStreamgetSource()Returns the source from which the image is read or retrieved.java.awt.image.BufferedImageread()Retrieves the image from the source.private java.awt.image.BufferedImagereadImage(javax.imageio.ImageReader reader)voidsetThumbnailParameter(ThumbnailParameter param)Sets theThumbnailParameterfrom which to retrieve parameters to use when retrieving the image.-
Methods inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSource
finishedReading, getInputFormatName
-
-
-
-
Field Detail
-
FIRST_IMAGE_INDEX
private static final int FIRST_IMAGE_INDEX
The index used to obtain the first image in an image file.- See Also:
- Constant Field Values
-
is
private java.io.InputStream is
AInputStreamfrom which the source image is to be read.
-
-
Constructor Detail
-
InputStreamImageSource
public InputStreamImageSource(java.io.InputStream is)
Instantiates anInputStreamImageSourcewith theInputStreamwhich will be used to read the source image.- Parameters:
is- TheInputStreamwhich is to be used to obtain the source image.- Throws:
java.lang.NullPointerException- If theInputStreamisnull.
-
-
Method Detail
-
setThumbnailParameter
public void setThumbnailParameter(ThumbnailParameter param)
Description copied from interface:ImageSourceSets theThumbnailParameterfrom which to retrieve parameters to use when retrieving the image.- Specified by:
setThumbnailParameterin interfaceImageSource<java.io.InputStream>- Overrides:
setThumbnailParameterin classAbstractImageSource<java.io.InputStream>- Parameters:
param- TheThumbnailParameterwith image reading parameters.
-
read
public java.awt.image.BufferedImage read() throws java.io.IOExceptionDescription copied from interface:ImageSourceRetrieves the image from the source.- Returns:
- The image.
- Throws:
java.io.IOException- When a problem occurs while reading or obtaining the image.
-
readImage
private java.awt.image.BufferedImage readImage(javax.imageio.ImageReader reader) throws java.io.IOException- Throws:
java.io.IOException
-
calculateSourceRegion
private java.awt.Rectangle calculateSourceRegion(int width, int height, Orientation orientation, Region region)
-
getSource
public java.io.InputStream getSource()
Description copied from interface:ImageSourceReturns the source from which the image is read or retrieved.- Returns:
- The source of the image.
-
-