Class: Jabber::Bytestreams::IqSiFileRange

Inherits:
XMPPElement show all
Defined in:
lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb

Overview

Information for ranged transfers

Instance Method Summary collapse

Methods inherited from XMPPElement

class_for_name_xmlns, #clone, force_xmlns, force_xmlns?, import, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=

Methods inherited from REXML::Element

#==, #delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text, #typed_add

Constructor Details

#initialize(offset = nil, length = nil) ⇒ IqSiFileRange

Returns a new instance of IqSiFileRange.



174
175
176
177
178
179
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb', line 174

def initialize(offset=nil, length=nil)
  super()

  self.offset = offset
  self.length = length
end

Instance Method Details

#lengthObject

File length (if not to transfer whole file)



195
196
197
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb', line 195

def length
  (attributes['length'] =~ /^\d+$/) ? attributes['length'].to_i : nil
end

#length=(o) ⇒ Object

Set file length



201
202
203
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb', line 201

def length=(o)
  attributes['length'] = (o ? o.to_s : nil)
end

#offsetObject

File offset (for continuing an interrupted transfer)



183
184
185
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb', line 183

def offset
  (attributes['offset'] =~ /^\d+$/) ? attributes['offset'].to_i : nil
end

#offset=(o) ⇒ Object

Set file offset



189
190
191
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/si.rb', line 189

def offset=(o)
  attributes['offset'] = (o ? o.to_s : nil)
end