Class: Rex::OLE::Stream

Inherits:
DirEntry show all
Defined in:
lib/rex/ole/stream.rb

Instance Attribute Summary

Attributes inherited from DirEntry

#_sidChild, #_sidLeftSib, #_sidRightSib, #sid

Instance Method Summary collapse

Methods inherited from DirEntry

#each, #find_by_sid, #find_stream_by_name_and_type, #from_s, #length, #name, #name=, #pack, #start_sector, #start_sector=, #to_s, #type, #type=

Constructor Details

#initialize(stg) ⇒ Stream

Returns a new instance of Stream.



13
14
15
16
17
18
19
# File 'lib/rex/ole/stream.rb', line 13

def initialize(stg)
  super

  # for reading/writing from this
  @offset = 0
  @_mse = STGTY_STREAM
end

Instance Method Details

#<<(expr) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/rex/ole/stream.rb', line 38

def <<(expr)
  if (not @data)
    @data = expr.dup
  else
    @data << expr
  end
  @_ulSize = @data.length
end

#closeObject



21
22
23
24
# File 'lib/rex/ole/stream.rb', line 21

def close
  @mode = nil
  @offset = nil
end

#read(len) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/rex/ole/stream.rb', line 30

def read(len)
  return nil if (not @data)

  ret = @data[@offset, len]
  @offset += len
  ret
end

#seek(offset) ⇒ Object



26
27
28
# File 'lib/rex/ole/stream.rb', line 26

def seek(offset)
  @offset = offset
end