@Override
public final FileBasedSource<T> createSourceForSubrange(long start, long end) {
checkArgument(
mode != Mode.FILEPATTERN, "Cannot split a file pattern based source based on positions");
checkArgument(
start >= getStartOffset(),
"Start offset value %s of the subrange cannot be smaller than the start offset value %s"
+ " of the parent source",
start,
getStartOffset());
checkArgument(
end <= getEndOffset(),
"End offset value %s of the subrange cannot be larger than the end offset value %s",
end,
getEndOffset());
checkState(
singleFileMetadata != null, "A single file source should not have null metadata: %s", this);
FileBasedSource<T> source = createForSubrangeOfFile(singleFileMetadata, start, end);
if (start > 0 || end != Long.MAX_VALUE) {
checkArgument(
source.getMode() == Mode.SINGLE_FILE_OR_SUBRANGE,
"Source created for the range [%s,%s) must be a subrange source",
start,
end);
}
return source;
}