Class: Mapi::Pst::RangesIOEncryptable

Inherits:
RangesIO
  • Object
show all
Defined in:
lib/mapi/pst.rb

Direct Known Subclasses

RangesIOIdxChain

Instance Method Summary collapse

Constructor Details

#initialize(io, mode = 'r', params = {}) ⇒ RangesIOEncryptable

Returns a new instance of RangesIOEncryptable.



243
244
245
246
247
# File 'lib/mapi/pst.rb', line 243

def initialize io, mode='r', params={}
  mode, params = 'r', mode if Hash === mode
  @decrypt = !!params[:decrypt]
  super
end

Instance Method Details

#encrypted?Boolean

Returns:

  • (Boolean)


249
250
251
# File 'lib/mapi/pst.rb', line 249

def encrypted?
  @decrypt
end

#read(limit = nil) ⇒ Object



253
254
255
256
257
# File 'lib/mapi/pst.rb', line 253

def read limit=nil
  buf = super
  buf = CompressibleEncryption.decrypt(buf) if encrypted?
  buf
end