RangeCalc

object RangeCalc
class Object
trait Matchable
class Any

Type members

Classlikes

final case class Offsets(firstChunk: Int, takeChunks: Int, dropStart: Int, takeEnd: Int)

Offsets counters for a sequence of chunks that make up the complete file to retrieve only a part from it.

Offsets counters for a sequence of chunks that make up the complete file to retrieve only a part from it.

Value parameters:
dropStart

how many bytes to drop from the first chunk

firstChunk

the number of the first chunk (starting from 0)

takeChunks

how many chunks to take starting from firstChunk

takeEnd

how many bytes to take from the last chunk. If first and last chunk are the same, then the dropStart must be applied first

Companion:
object
object Offsets
Companion:
class

Value members

Concrete methods

def calcChunks(range: ByteRange, chunkSize: Int): Stream[Pure, Chunk]

Given a chunkSize, generates an possibly infinite stream of chunk definitions.

Given a chunkSize, generates an possibly infinite stream of chunk definitions.

def calcOffset(range: ByteRange, chunkSize: Int): Offsets

Calculates the offsets to use when fetching only a range from a file. The given chunkSize is size for each chunk except the last one (which may have fewer bytes).

Calculates the offsets to use when fetching only a range from a file. The given chunkSize is size for each chunk except the last one (which may have fewer bytes).

Value parameters:
chunkSize

the overall chunk size used; the last chunk may be smaller

range

the given range that should be retrieved

def chop(ch: Chunk[Byte], offsets: Offsets, index: Int): Chunk[Byte]

Give a chunk, chops off some bytes according to the give offsets. This can only affect the first and last chunk. The index defines which chunk it is.

Give a chunk, chops off some bytes according to the give offsets. This can only affect the first and last chunk. The index defines which chunk it is.

def chopOffsets(offsets: Offsets, chunkIndex: Int): (Option[Int], Option[Int])