request

abstract fun request(skip: Int, atLeast: Int): ByteBuffer?

Request byte buffer range skipping skip bytes and atLeast bytes length

Return

byte buffer for the requested range or null if it is impossible to provide such a buffer

There are the following reasons for this function to return null:

  • not enough bytes available yet (should be at least skip + atLeast bytes available)

  • due to buffer fragmentation it is impossible to represent the requested range as a single byte buffer

  • end of stream encountered and all bytes were consumed

  • channel has been closed with an exception so buffer has been recycled