mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Minor improvement, use real length when known.
This commit is contained in:
parent
9610256ddb
commit
d78e6373a8
@ -195,7 +195,8 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
|
|||||||
if (marker == JPEG.SOS) {
|
if (marker == JPEG.SOS) {
|
||||||
// Treat rest of stream as a single segment (scanning for EOI is too much work)
|
// Treat rest of stream as a single segment (scanning for EOI is too much work)
|
||||||
// TODO: For progressive, there will be more than one SOS...
|
// TODO: For progressive, there will be more than one SOS...
|
||||||
segments.add(new Segment(-1, segment.realEnd(), segment.end(), Long.MAX_VALUE - segment.realEnd()));
|
long end = stream.length() > 0 ? stream.length() : Long.MAX_VALUE;
|
||||||
|
segments.add(new Segment(-1, segment.realEnd(), segment.end(), end - segment.realEnd()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streamPos >= segment.start && streamPos < segment.end()) {
|
if (streamPos >= segment.start && streamPos < segment.end()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user