[SPARK-3442] LengthBoundedInputStream

This commit creates LengthBoundedInputStream, an InputStream decorator that limits the number of bytes returned from an underlying InputStream. This will be used to create an InputStream directly from a segment of a file (FileInputStream always reads till EOF).