Method: Rubcask::DataFile#read

Defined in:
lib/rubcask/data_file.rb

#read(size = nil) ⇒ DataEntry?

Note:

Calling this method might change ‘pos` of the `file`

Read an entry at the current file position

Parameters:

  • size (Integer, nil) (defaults to: nil)

    Entry size in bytes

Returns:

  • (DataEntry)
  • (nil)

    if at the end of file

Raises:



70
71
72
73
74
# File 'lib/rubcask/data_file.rb', line 70

def read(size = nil)
  read_from_io(
    size ? StringIO.new(@file.read(size)) : @file
  )
end