class Fog::Storage::AzureRM::Real::BlobFileStream
This class is a stream to read chunk data.
Public Class Methods
new(body)
click to toggle source
# File lib/fog/azurerm/requests/storage/save_page_blob.rb, line 25 def initialize(body) if body.respond_to?(:read) if body.respond_to?(:rewind) begin body.rewind rescue => ex Fog::Logger.debug "save_page_blob - body responds to :rewind but throws an exception when calling :rewind: #{ex.inspect}" end end @stream = body else @stream = StringIO.new(body) end @mutex = Mutex.new @count = 0 end
Public Instance Methods
read(size)
click to toggle source
# File lib/fog/azurerm/requests/storage/save_page_blob.rb, line 42 def read(size) data = nil id = 0 start_range = 0 @mutex.synchronize do start_range = @stream.pos data = @stream.read(size) return nil if data.nil? @count += 1 id = @count end BlobChunk.new(id, start_range, data) end