class PPTX::OPC::FilePart

Public Class Methods

new(package, file) click to toggle source
Calls superclass method PPTX::OPC::BinaryPart::new
# File lib/pptx/opc/file_part.rb, line 4
def initialize(package, file)
  super(package, File.basename(file))
  @file = file
  @chunk_size = 16 * 1024
end

Public Instance Methods

marshal() click to toggle source
# File lib/pptx/opc/file_part.rb, line 10
def marshal
  IO.read(@file)
end
size() click to toggle source
# File lib/pptx/opc/file_part.rb, line 14
def size
  File.size(@file)
end
stream(out) click to toggle source
# File lib/pptx/opc/file_part.rb, line 18
def stream(out)
  File.open(@file, 'r') do |file|
    while chunk = file.read(@chunk_size)
      puts "Streaming file: #{chunk && chunk.bytesize} bytes"
      out << chunk
    end
  end
end