mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 12:35:29 -04:00
More tolerant CCITT reading if the stream contains less lines than are tried to read
This commit is contained in:
parent
a1de9ff448
commit
2258b4def2
@ -34,6 +34,7 @@ import java.io.EOFException;
|
|||||||
import java.io.FilterInputStream;
|
import java.io.FilterInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CCITT Modified Huffman RLE, Group 3 (T4) and Group 4 (T6) fax compression.
|
* CCITT Modified Huffman RLE, Group 3 (T4) and Group 4 (T6) fax compression.
|
||||||
@ -403,14 +404,14 @@ final class CCITTFaxDecoderStream extends FilterInputStream {
|
|||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
if (decodedLength < 0) {
|
if (decodedLength < 0) {
|
||||||
return -1;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decodedPos >= decodedLength) {
|
if (decodedPos >= decodedLength) {
|
||||||
fetch();
|
fetch();
|
||||||
|
|
||||||
if (decodedLength < 0) {
|
if (decodedLength < 0) {
|
||||||
return -1;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,14 +421,16 @@ final class CCITTFaxDecoderStream extends FilterInputStream {
|
|||||||
@Override
|
@Override
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
public int read(byte[] b, int off, int len) throws IOException {
|
||||||
if (decodedLength < 0) {
|
if (decodedLength < 0) {
|
||||||
return -1;
|
Arrays.fill(b, off, len, (byte)0xFF);
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decodedPos >= decodedLength) {
|
if (decodedPos >= decodedLength) {
|
||||||
fetch();
|
fetch();
|
||||||
|
|
||||||
if (decodedLength < 0) {
|
if (decodedLength < 0) {
|
||||||
return -1;
|
Arrays.fill(b, off, len, (byte)0xFF);
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user