Package com.github.jaiimageio.stream
Class StreamSegmentMapperImpl
- java.lang.Object
-
- com.github.jaiimageio.stream.StreamSegmentMapperImpl
-
- All Implemented Interfaces:
StreamSegmentMapper
class StreamSegmentMapperImpl extends java.lang.Object implements StreamSegmentMapper
An implementation of theStreamSegmentMapper
interface that requires an explicit list of the starting locations and lengths of the source segments.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
segmentLengths
private long[]
segmentPositions
-
Constructor Summary
Constructors Constructor Description StreamSegmentMapperImpl(long[] segmentPositions, int[] segmentLengths)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamSegment
getStreamSegment(long position, int length)
Returns aStreamSegment
object indicating the location of the initial portion of a desired segment in the source stream.void
getStreamSegment(long position, int length, StreamSegment seg)
Sets the values of aStreamSegment
object indicating the location of the initial portion of a desired segment in the source stream.(package private) long
length()
-
-
-
Method Detail
-
getStreamSegment
public StreamSegment getStreamSegment(long position, int length)
Description copied from interface:StreamSegmentMapper
Returns aStreamSegment
object indicating the location of the initial portion of a desired segment in the source stream. The length of the returnedStreamSegment
may be smaller than the desired length.- Specified by:
getStreamSegment
in interfaceStreamSegmentMapper
- Parameters:
position
- The desired starting position in theSegmentedImageInputStream
, as along
.length
- The desired segment length.- Returns:
- a StreamSegment object
-
getStreamSegment
public void getStreamSegment(long position, int length, StreamSegment seg)
Description copied from interface:StreamSegmentMapper
Sets the values of aStreamSegment
object indicating the location of the initial portion of a desired segment in the source stream. The length of the returnedStreamSegment
may be smaller than the desired length.- Specified by:
getStreamSegment
in interfaceStreamSegmentMapper
- Parameters:
position
- The desired starting position in theSegmentedImageInputStream
, as along
.length
- The desired segment length.seg
- AStreamSegment
object to be overwritten.
-
length
long length()
-
-