Method: Rubcask::DataFile#pread

Defined in:
lib/rubcask/data_file.rb

#pread(offset, size) ⇒ DataEntry?

Note:

Calling this method will not change ‘pos` of the `file`

Fetch an entry at given offset and with provided size

Parameters:

  • offset (Integer)

    File offset in bytes

  • size (Integer)

    Entry size in bytes

Returns:

  • (DataEntry)
  • (nil)

    if at the end of file

Raises:



81
82
83
# File 'lib/rubcask/data_file.rb', line 81

def pread(offset, size)
  read_from_io(StringIO.new(@file.pread(size, offset)))
end