From d64ce278f01cafc1c3c23aec9bb2394412ad160b Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 11 Aug 2016 00:30:34 -0400 Subject: update documentation --- Zip/Entry.html | 318 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 265 insertions(+), 53 deletions(-) (limited to 'Zip/Entry.html') diff --git a/Zip/Entry.html b/Zip/Entry.html index 9e31614..02dd78d 100644 --- a/Zip/Entry.html +++ b/Zip/Entry.html @@ -85,8 +85,28 @@ -
  • - WriterEntry +
  • + Writers + + +
  • @@ -184,35 +204,56 @@ io = MemoryIO.new<
  • #comment : String +

    Get comment for this Entry as a String.

    +
  • #compressed_size : UInt32 +

    Get compressed size for this Entry as a UInt32.

    +
  • #crc : UInt32 +

    Get CRC-32 for this Entry as a UInt32.

    + +
  • + +
  • + #dir? : Bool + +

    Returns true if this entry a directory.

    +
  • - #external_attr : UInt32 + #external : UInt32 + +

    Get external attributes for this Entry as a UInt32.

  • #extras : Array(Zip::Extra) +

    Get Extra data for this Entry as an Array.

    +
  • #flags : UInt16 +

    Get GeneralFlags for this Entry.

    +
  • - #internal_attr : UInt16 + #internal : UInt16 + +

    Get internal attributes for this Entry as a UInt16.

  • @@ -226,49 +267,63 @@ io = MemoryIO.new<
  • #method : Zip::CompressionMethod +

    Get CompressionMethod for this Entry.

    +
  • #path : String +

    Get path for this Entry as a String.

    +
  • #pos : UInt32 +

    Get position for this Entry as a UInt32.

    +
  • - #read(dst_io : IO) : UInt32 + #size : UInt32 -

    Write contents of Entry into given IO.

    +

    Get uncompressed size for this Entry as a UInt32.

  • - #size : UInt32 + #time : Time -

    Return the uncompressed size of this entry in bytes.

    +

    Get Time for this Entry.

  • - #time : Time + #version : UInt16 + +

    Get Version used to generate this Entry.

  • - #uncompressed_size : UInt32 + #version_needed : UInt16 + +

    Get Version needed to generate this Entry.

  • - #version : UInt16 + #write(path : String) : UInt32 + +

    Write contents of Entry into given path path and return the number of bytes written.

  • - #version_needed : UInt16 + #write(dst_io : IO) : UInt32 + +

    Write contents of Entry into given IO.

  • @@ -352,6 +407,15 @@ io = MemoryIO.new< # +

    Get comment for this Entry as a String.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print comment for each entry
    +  zip.each do |e|
    +    puts "#{e.path} comment: #{e.comment}"
    +  end
    +end
    +
    @@ -366,6 +430,15 @@ io = MemoryIO.new< #
    +

    Get compressed size for this Entry as a UInt32.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print compressed size for each entry
    +  zip.each do |e|
    +    puts "#{e.path} compressed size: #{e.compressed_size}"
    +  end
    +end
    +
    @@ -380,20 +453,61 @@ io = MemoryIO.new< #
    +

    Get CRC-32 for this Entry as a UInt32.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print crc for each entry
    +  zip.each do |e|
    +    puts "#{e.path} CRC-32: #{e.crc}"
    +  end
    +end
    +
    -
    +
    - def external_attr : UInt32 + def dir? : Bool - # + #
    +

    Returns true if this entry a directory.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  type = zip["some-dir/"].dir? ? "directory" : "file"
    +  puts "#{path} is a #{type}"
    +end
    + +
    +
    + +
    +
    + +
    +
    + + def external : UInt32 + + # +
    + +

    Get external attributes for this Entry as a UInt32.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print external attributes for each entry
    +  zip.each do |e|
    +    puts "#{e.path} external attributes: #{e.external}"
    +  end
    +end
    +
    @@ -408,6 +522,15 @@ io = MemoryIO.new< #
    +

    Get Extra data for this Entry as an Array.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print number of extra data items for each entry
    +  zip.each do |e|
    +    puts "#{e.path} extras: #{e.extras.size}"
    +  end
    +end
    +
    @@ -422,20 +545,38 @@ io = MemoryIO.new< #
    +

    Get GeneralFlags for this Entry.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print flags for each entry
    +  zip.each do |e|
    +    puts "#{e.path} flags: #{e.flags}"
    +  end
    +end
    +
    -
    +
    - def internal_attr : UInt16 + def internal : UInt16 - # + #
    +

    Get internal attributes for this Entry as a UInt16.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print internal attributes for each entry
    +  zip.each do |e|
    +    puts "#{e.path} internal attributes: #{e.internal}"
    +  end
    +end
    +
    @@ -482,6 +623,15 @@ file's entry in the Central Directory, and this method returns the #
    +

    Get CompressionMethod for this Entry.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print compression method for each entry
    +  zip.each do |e|
    +    puts "#{e.path} compression method: #{e.method}"
    +  end
    +end
    +
    @@ -496,6 +646,15 @@ file's entry in the Central Directory, and this method returns the #
    +

    Get path for this Entry as a String.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print uncompressed size for each entry
    +  zip.each do |e|
    +    puts "#{e.path}"
    +  end
    +end
    +
    @@ -510,33 +669,35 @@ file's entry in the Central Directory, and this method returns the #
    +

    Get position for this Entry as a UInt32.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print position for each entry
    +  zip.each do |e|
    +    puts "#{e.path} position: #{e.pos}"
    +  end
    +end
    +
    -
    +
    - def read(dst_io : IO) : UInt32 + def size : UInt32 - # + #
    -

    Write contents of Entry into given IO.

    - -

    Raises an Error if the file contents could not be read or if the -compression method is unsupported.

    +

    Get uncompressed size for this Entry as a UInt32.

    -

    Example:

    - -
    # open "output-bar.txt" for writing
    -File.open("output-bar.txt", "wb") do |io|
    -  # open archive "./foo.zip"
    -  Zip.read("foo.zip") do |zip|
    -    # write contents of "bar.txt" to "output-bar.txt"
    -    zip["foo.txt"].read(io)
    +
    Zip.read("foo.zip") do |zip|
    +  # print uncompressed size for each entry
    +  zip.each do |e|
    +    puts "#{e.path} uncompressed size: #{e.size}"
       end
     end
    @@ -546,21 +707,21 @@ compression method is unsupported.

    -
    +
    - def size : UInt32 + def time : Time - # + #
    -

    Return the uncompressed size of this entry in bytes.

    - -

    Example:

    +

    Get Time for this Entry.

    Zip.read("foo.zip") do |zip|
    -  size = zip["bar.txt"].size
    -  puts "bar.txt is #{size} bytes."
    +  # print time for each entry
    +  zip.each do |e|
    +    puts "#{e.path} time: #{e.time}"
    +  end
     end

    @@ -569,56 +730,107 @@ compression method is unsupported.

    -
    +
    - def time : Time + def version : UInt16 - # + #
    +

    Get Version used to generate this Entry.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print version used for each entry
    +  zip.each do |e|
    +    puts "#{e.path} version used: #{e.version}"
    +  end
    +end
    +
    -
    +
    - def uncompressed_size : UInt32 + def version_needed : UInt16 - # + #
    +

    Get Version needed to generate this Entry.

    + +
    Zip.read("foo.zip") do |zip|
    +  # print version needed to extract each entry
    +  zip.each do |e|
    +    puts "#{e.path} version needed: #{e.version_needed}"
    +  end
    +end
    +
    -
    +
    - def version : UInt16 + def write(path : String) : UInt32 - # + #
    +

    Write contents of Entry into given path path and return the +number of bytes written.

    + +

    Raises an Error if the file contents could not be read or if the +compression method is unsupported.

    + +

    Example:

    + +
    # open "output-bar.txt" for writing
    +File.open("output-bar.txt", "wb") do |io|
    +  # open archive "./foo.zip"
    +  Zip.read("foo.zip") do |zip|
    +    # write contents of "bar.txt" to "output-bar.txt"
    +    zip["foo.txt"].write(io)
    +  end
    +end
    +
    -
    +
    - def version_needed : UInt16 + def write(dst_io : IO) : UInt32 - # + #
    +

    Write contents of Entry into given IO.

    + +

    Raises an Error if the file contents could not be read or if the +compression method is unsupported.

    + +

    Example:

    + +
    # open "output-bar.txt" for writing
    +File.open("output-bar.txt", "wb") do |io|
    +  # open archive "./foo.zip"
    +  Zip.read("foo.zip") do |zip|
    +    # write contents of "bar.txt" to "output-bar.txt"
    +    zip["foo.txt"].write(io)
    +  end
    +end
    +
    -- cgit v1.2.3