Class: Mapi::Pst::RangesIOIdxChain

Inherits:
RangesIOEncryptable show all
Defined in:
lib/mapi/pst.rb

Direct Known Subclasses

RangesIOID2

Instance Method Summary collapse

Methods inherited from RangesIOEncryptable

#encrypted?, #read

Constructor Details

#initialize(pst, idx_head) ⇒ RangesIOIdxChain

Returns a new instance of RangesIOIdxChain.

Raises:

  • (NotImplementedError)


887
888
889
890
891
892
893
894
895
896
897
898
# File 'lib/mapi/pst.rb', line 887

def initialize pst, idx_head
	@idxs = pst.id2_block_idx_chain idx_head
	# whether or not a given idx needs encrypting
	decrypts = @idxs.map do |idx|
		decrypt = (idx.id & 2) != 0 ? false : pst.encrypted?
	end.uniq
	raise NotImplementedError, 'partial encryption in RangesIOID2' if decrypts.length > 1
	decrypt = decrypts.first
	# convert idxs to ranges
	ranges = @idxs.map { |idx| [idx.offset, idx.size] }
	super pst.io, :ranges => ranges, :decrypt => decrypt
end