Class AbstractRLEDecoder
java.lang.Object
com.twelvemonkeys.imageio.plugins.bmp.AbstractRLEDecoder
- All Implemented Interfaces:
Decoder
- Direct Known Subclasses:
RLE4Decoder
,RLE8Decoder
Abstract base class for RLE decoding as specified by in the Windows BMP (aka DIB) file format.
- Version:
- $Id: AbstractRLEDecoder.java#1 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static int
checkEOF
(int val) Checks a read byte for EOF marker.final int
decode
(InputStream stream, ByteBuffer buffer) Decodes as much data as possible, from the stream into the buffer.protected abstract void
decodeRow
(InputStream stream) Decodes one full row of image data.
-
Field Details
-
width
protected final int width -
bitsPerSample
protected final int bitsPerSample -
row
protected final byte[] row -
srcX
protected int srcX -
srcY
protected int srcY -
dstX
protected int dstX -
dstY
protected int dstY
-
-
Constructor Details
-
AbstractRLEDecoder
AbstractRLEDecoder(int width, int bitsPerSample) Creates an RLEDecoder. As RLE encoded BMPs may contain x and y deltas, etc, we need to know height and width of the image.- Parameters:
width
- width of the imagebitsPerSample
- pits per sample
-
-
Method Details
-
decodeRow
Decodes one full row of image data.- Parameters:
stream
- the input stream containing RLE data- Throws:
IOException
- if an I/O related exception occurs while reading
-
decode
Decodes as much data as possible, from the stream into the buffer.- Specified by:
decode
in interfaceDecoder
- Parameters:
stream
- the input stream containing RLE databuffer
- the buffer to decode the data to- Returns:
- the number of bytes decoded from the stream, to the buffer
- Throws:
IOException
- if an I/O related exception occurs while reading
-
checkEOF
Checks a read byte for EOF marker.- Parameters:
val
- the byte to check- Returns:
- the value of
val
if positive. - Throws:
EOFException
- ifval
is negative
-