Class PNMImageReader
java.lang.Object
javax.imageio.ImageReader
com.github.jaiimageio.impl.plugins.pnm.PNMImageReader
This class is the Java Image IO plugin reader for PNM images.
It may subsample the image, clip the image, select sub-bands,
and shift the decoded image origin if the proper decoding parameter
are set in the provided
PNMImageReadParam.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate booleanIndicates whether the header is read.private intThe original image height.private ImageInputStreamThe input stream where reads fromprivate longThe stream position where the image data starts.private static final intprivate static byte[]private intMaximum pixel value.private PNMMetadataprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate StringTokenizerprivate intFile variant: PBM/PGM/PPM, ASCII/RAW.private intThe original image width.Fields inherited from class ImageReader
availableLocales, ignoreMetadata, input, locale, minIndex, originatingProvider, progressListeners, seekForwardOnly, updateListeners, warningListeners, warningLocales -
Constructor Summary
ConstructorsConstructorDescriptionPNMImageReader(ImageReaderSpi originator) ConstructsPNMImageReaderfrom the providedImageReaderSpi. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprivate voidcheckIndex(int imageIndex) intgetHeight(int imageIndex) getImageMetadata(int imageIndex) getImageTypes(int imageIndex) intintgetNumImages(boolean allowSearch) Overrides the method defined in the superclass.intintgetWidth(int imageIndex) booleanisRandomAccessEasy(int imageIndex) private booleanisRaw(int v) Returns true if file variant is raw format, false if ASCII.read(int imageIndex, ImageReadParam param) private voidreadComments(ImageInputStream stream, PNMMetadata metadata) Reads the comments.voidprivate intreadInteger(ImageInputStream stream) Reads the next integer.readRaster(int imageIndex, ImageReadParam param) voidreset()voidOverrides the method defined in the superclass.private voidskipInteger(ImageInputStream stream, int num) Methods inherited from class ImageReader
abort, abortRequested, addIIOReadProgressListener, addIIOReadUpdateListener, addIIOReadWarningListener, checkReadParamBandSettings, clearAbortRequest, computeRegions, dispose, getAspectRatio, getAvailableLocales, getDestination, getFormatName, getImageMetadata, getInput, getLocale, getMinIndex, getNumThumbnails, getOriginatingProvider, getRawImageType, getSourceRegion, getStreamMetadata, getThumbnailHeight, getThumbnailWidth, getTileGridXOffset, getTileGridYOffset, getTileHeight, getTileWidth, hasThumbnails, isIgnoringMetadata, isImageTiled, isSeekForwardOnly, processImageComplete, processImageProgress, processImageStarted, processImageUpdate, processPassComplete, processPassStarted, processReadAborted, processSequenceComplete, processSequenceStarted, processThumbnailComplete, processThumbnailPassComplete, processThumbnailPassStarted, processThumbnailProgress, processThumbnailStarted, processThumbnailUpdate, processWarningOccurred, processWarningOccurred, read, readAll, readAll, readAsRenderedImage, readerSupportsThumbnails, readThumbnail, readTile, readTileRaster, removeAllIIOReadProgressListeners, removeAllIIOReadUpdateListeners, removeAllIIOReadWarningListeners, removeIIOReadProgressListener, removeIIOReadUpdateListener, removeIIOReadWarningListener, setInput, setInput, setLocale
-
Field Details
-
PBM_ASCII
private static final int PBM_ASCII- See Also:
-
PGM_ASCII
private static final int PGM_ASCII- See Also:
-
PPM_ASCII
private static final int PPM_ASCII- See Also:
-
PBM_RAW
private static final int PBM_RAW- See Also:
-
PGM_RAW
private static final int PGM_RAW- See Also:
-
PPM_RAW
private static final int PPM_RAW- See Also:
-
LINE_FEED
private static final int LINE_FEED- See Also:
-
lineSeparator
private static byte[] lineSeparator -
variant
private int variantFile variant: PBM/PGM/PPM, ASCII/RAW. -
maxValue
private int maxValueMaximum pixel value. -
iis
The input stream where reads from -
gotHeader
private boolean gotHeaderIndicates whether the header is read. -
imageDataOffset
private long imageDataOffsetThe stream position where the image data starts. -
width
private int widthThe original image width. -
height
private int heightThe original image height. -
aLine
-
token
-
metadata
-
-
Constructor Details
-
PNMImageReader
ConstructsPNMImageReaderfrom the providedImageReaderSpi.
-
-
Method Details
-
setInput
Overrides the method defined in the superclass.- Overrides:
setInputin classImageReader
-
getNumImages
Overrides the method defined in the superclass.- Specified by:
getNumImagesin classImageReader- Throws:
IOException
-
getWidth
- Specified by:
getWidthin classImageReader- Throws:
IOException
-
getHeight
- Specified by:
getHeightin classImageReader- Throws:
IOException
-
getVariant
public int getVariant() -
getMaxValue
public int getMaxValue() -
checkIndex
private void checkIndex(int imageIndex) -
readHeader
- Throws:
IOException
-
getImageTypes
- Specified by:
getImageTypesin classImageReader- Throws:
IOException
-
getDefaultReadParam
- Overrides:
getDefaultReadParamin classImageReader
-
getImageMetadata
- Specified by:
getImageMetadatain classImageReader- Throws:
IOException
-
getStreamMetadata
- Specified by:
getStreamMetadatain classImageReader- Throws:
IOException
-
isRandomAccessEasy
- Overrides:
isRandomAccessEasyin classImageReader- Throws:
IOException
-
read
- Specified by:
readin classImageReader- Throws:
IOException
-
canReadRaster
public boolean canReadRaster()- Overrides:
canReadRasterin classImageReader
-
readRaster
- Overrides:
readRasterin classImageReader- Throws:
IOException
-
reset
public void reset()- Overrides:
resetin classImageReader
-
isRaw
private boolean isRaw(int v) Returns true if file variant is raw format, false if ASCII. -
readComments
Reads the comments.- Throws:
IOException
-
readInteger
Reads the next integer.- Throws:
IOException
-
skipInteger
- Throws:
IOException
-