public static class ImageExtractor.GifFileReader extends java.lang.Object implements ImageExtractor.ImageReader
Modifier and Type | Class and Description |
---|---|
(package private) class |
ImageExtractor.GifFileReader.ApplicationExtensionReader
Represents the Application Extension section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.ColorTableReader
Represents the GIF Color Table section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.CommentExtensionReader
Represents the Comment Extension section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.ExtensionReader
Defines common methods to detect GIF extension section.
|
(package private) class |
ImageExtractor.GifFileReader.GraphicsControlExtensionReader
Represents the Graphics Control Extension section.
|
(package private) class |
ImageExtractor.GifFileReader.HeaderReader
Represents the GIF header section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.ImageDataReader
Represents the Image Data section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.ImageDescriptorReader
Represents the Image Descriptor section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.LogicalScreenDescriptorReader
Represents the GIF Logical Screen Descriptor section recognizer.
|
(package private) class |
ImageExtractor.GifFileReader.PlainTextExtensionReader
Represents the Plain Text Extension section recognizer.
|
Modifier and Type | Field and Description |
---|---|
private static byte |
APPLICATION_EXT_MARKER
Represents the next byte of Graphics Control Extension.
|
private ImageExtractor.GifFileReader.ApplicationExtensionReader |
applicationExtension
The reader for Application Extension section of GIF image
|
private static byte |
COMMENT_EXT_MARKER
Represents the next byte of Comment Extension.
|
private ImageExtractor.GifFileReader.CommentExtensionReader |
commentExtension
The reader for Comment Extension section of GIF image
|
private static byte |
EXTENSION_MARKER
Represents the beginning of special GIF extension sections: Plain Text Extension,
Graphics Control Extension, Application Extension and Comment Extension.
|
private static byte[] |
GIF
Represents the first three bytes of gif image: GIF.
|
private static byte |
GRAPHICS_EXT_MARKER
Represents the next byte of Graphics Control Extension.
|
private ImageExtractor.GifFileReader.GraphicsControlExtensionReader |
graphicsControlExtension
The reader for Graphics Control Extension section of GIF image
|
private ImageExtractor.GifFileReader.HeaderReader |
header
The reader for Header section of GIF image
|
private ImageExtractor.GifFileReader.ImageDataReader |
imageData
The reader for Image Data section of GIF image
|
private ImageExtractor.GifFileReader.ImageDescriptorReader |
imageDescriptor
The reader for Image Descriptor section of GIF image
|
private long |
imageHeaderOffset
Represents the file offset of the Header section.
|
private int |
imageSize
Stores the image data size.
|
private int |
index
Stores the current index.
|
private byte[] |
output
Stores the extracted image data.
|
private static byte |
PLAIN_TEXT_EXT_MARKER
Represents the next byte of Plain Text Extension.
|
private ImageExtractor.GifFileReader.PlainTextExtensionReader |
plainTextExtension
The reader for Plain Text Extension section of GIF image
|
private ImageExtractor.GifFileReader.LogicalScreenDescriptorReader |
screenDescriptor
The reader for Logical Screen Descriptor section of GIF image
|
private static byte |
TRAILER
Represents the trailer marker.
|
private static byte[] |
VERSION_87
Represents the next three bytes of the tested gif image and defines the GIF version: 87a.
|
private static byte[] |
VERSION_89
Represents the next three bytes of the tested gif image and defines the GIF version: 89a.
|
Constructor and Description |
---|
GifFileReader() |
Modifier and Type | Method and Description |
---|---|
byte[] |
getImageData()
Returns the binary image data.
|
java.lang.String |
getImageFileExtension()
Returns the GIF image standard extension.
|
int |
getImageIndex()
Returns the current image count as its index value, a 1-based index.
|
boolean |
nextImage(java.io.RandomAccessFile raf)
Extracts a first available GIF image data starting from the current file offset.
|
private boolean |
readAllSubBlocks(java.io.RandomAccessFile raf)
Read a GIF data sub-block moving the file pointer after this detected block.
|
private int |
readUnsignedShort(java.io.RandomAccessFile raf)
Read unsigned short serialized as little-endian sequence of bytes.
|
private boolean |
skipCurrentBlock(java.io.RandomAccessFile raf)
Skip a block of N + 1 bytes given by the following format:
N x1 x2 ....
|
private boolean |
testTrailer(java.io.RandomAccessFile raf)
Tests if the currently read byte holds 0x3B, otherwise the file pointer has been rolled back.
|
private static final byte[] GIF
private static final byte[] VERSION_89
private static final byte[] VERSION_87
private static final byte EXTENSION_MARKER
private static final byte PLAIN_TEXT_EXT_MARKER
private static final byte GRAPHICS_EXT_MARKER
private static final byte APPLICATION_EXT_MARKER
private static final byte COMMENT_EXT_MARKER
private static final byte TRAILER
private long imageHeaderOffset
private byte[] output
private int imageSize
private int index
private ImageExtractor.GifFileReader.HeaderReader header
private ImageExtractor.GifFileReader.LogicalScreenDescriptorReader screenDescriptor
private ImageExtractor.GifFileReader.GraphicsControlExtensionReader graphicsControlExtension
private ImageExtractor.GifFileReader.PlainTextExtensionReader plainTextExtension
private ImageExtractor.GifFileReader.ApplicationExtensionReader applicationExtension
private ImageExtractor.GifFileReader.CommentExtensionReader commentExtension
private ImageExtractor.GifFileReader.ImageDescriptorReader imageDescriptor
private ImageExtractor.GifFileReader.ImageDataReader imageData
public boolean nextImage(java.io.RandomAccessFile raf) throws java.io.IOException
nextImage
in interface ImageExtractor.ImageReader
raf
- The data represented by the random access filejava.io.IOException
- If IO error occurs while reading data and moving the current file pointer.public byte[] getImageData()
getImageData
in interface ImageExtractor.ImageReader
public int getImageIndex()
getImageIndex
in interface ImageExtractor.ImageReader
public java.lang.String getImageFileExtension()
getImageFileExtension
in interface ImageExtractor.ImageReader
private boolean testTrailer(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- The data represented by the random access filejava.io.IOException
- If IO error occurs while reading data and moving the current file pointer.private boolean readAllSubBlocks(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- The data represented by the random access filejava.io.IOException
- If IO error occurs while reading data and moving the current file pointer.private int readUnsignedShort(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- The data represented by the random access filejava.io.IOException
- If IO error occurs while reading data and moving the current file pointer.private boolean skipCurrentBlock(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- The data represented by the random access filejava.io.IOException
- If IO error occurs while reading data and moving the current file pointer.