Module: Mobi::MetadataStreams

Defined in:
lib/mobi/metadata_streams.rb

Class Method Summary collapse

Class Method Details

.exth_stream(file, header_length) ⇒ Object

Creates a stream starting at the EXTH header in Record 0.

Returns a StreamSlicer.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mobi/metadata_streams.rb', line 18

def self.exth_stream(file, header_length)
  record_zero_stream = record_zero_stream(file)

  record_zero_offset     = record_zero_stream.start
  palm_doc_header_length = 16

  exth_off = record_zero_offset +
             palm_doc_header_length +
             header_length

  StreamSlicer.new(file, exth_off, record_zero_stream.stop)
end

.record_zero_stream(file) ⇒ Object

Creates a stream starting at the Record 0 in the PalmDOC.

Returns a StreamSlicer.



7
8
9
10
11
12
13
# File 'lib/mobi/metadata_streams.rb', line 7

def self.record_zero_stream(file)
  data = StreamSlicer.new(file)

  start, stop = record_zero_endpoints(data)

  StreamSlicer.new(file, start, stop)
end