From 25199ab4c29057d7c0a73812fc8f2ac3605c1d86 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 10 Aug 2016 21:04:41 -0400 Subject: add documentation --- Zip/Entry.html | 636 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 636 insertions(+) create mode 100644 Zip/Entry.html (limited to 'Zip/Entry.html') diff --git a/Zip/Entry.html b/Zip/Entry.html new file mode 100644 index 0000000..6626777 --- /dev/null +++ b/Zip/Entry.html @@ -0,0 +1,636 @@ + + + + + + + + Zip::Entry - github.com/pablotron/zip-crystal + + + +
+ + + + + + +
+ +
+

+ + class Zip::Entry + +

+ + + + + + + +

Overview

+ +

File entry in Archive.

+ +

Use Zip.read() to read a Zip archive, then #[] to fetch a +specific archive entry.

+ +

Example:

+ +

# create MemoryIO +io = MemoryIO.new

+ +

# open "foo.zip" +Zip.read("foo.zip") do |zip| +# get "bar.txt" entry from "foo.zip" +e = zip["bar.txt"]

+ +
# read contents of "bar.txt" into io
+e.read(io)
+ +

end

+ + + + + +

Included Modules

+ + + + + + + + + + + +

Defined in:

+ + + + + + +

Class Method Summary

+ + + + +

Instance Method Summary

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

Class Method Detail

+ +
+
+ + def self.new(io : Source) + + # +
+ +

Instantiate a new Entry object from the given IO.

+ +

You should not need to call this method directly (use +Zip::Archive#[] instead).

+ +
+
+ +
+
+ + + + +

Instance Method Detail

+ +
+
+ + def comment : String + + # +
+ +
+
+ +
+
+ +
+
+ + def compressed_size : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def crc : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def external_attr : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def extras : Array(Zip::Extra) + + # +
+ +
+
+ +
+
+ +
+
+ + def flags : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def internal_attr : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def local_extras : Array(Extra) + + # +
+ +

Returns an array of Extra attributes for this Entry.

+ +

Zip archives can (and do) have separate Extra attributes +associated with the file entry itself, and the file's entry in the +Central Directory.

+ +

The #extras method returns the Extra attributes from the +file's entry in the Central Directory, and this method returns the +Extra data from the file entry itself.

+ +

Example:

+ +

# open "./foo.zip" +Zip.read("./foo.zip") do |zip| +# get array of local extra attributes from "bar.txt" +extras = zip["bar.txt"].local_extras +end

+ +
+
+ +
+
+ +
+
+ + def method : Zip::CompressionMethod + + # +
+ +
+
+ +
+
+ +
+
+ + def path : String + + # +
+ +
+
+ +
+
+ +
+
+ + def pos : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def read(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"].read(io) +end +end

+ +
+
+ +
+
+ +
+
+ + def size : UInt32 + + # +
+ +

Return the uncompressed size of this entry in bytes.

+ +

Example:

+ +

Zip.read("foo.zip") do |zip| +size = zip["bar.txt"].size +puts "bar.txt is #{size} bytes." +end

+ +
+
+ +
+
+ +
+
+ + def time : Time + + # +
+ +
+
+ +
+
+ +
+
+ + def uncompressed_size : UInt32 + + # +
+ +
+
+ +
+
+ +
+
+ + def version : UInt16 + + # +
+ +
+
+ +
+
+ +
+
+ + def version_needed : UInt16 + + # +
+ +
+
+ +
+
+ + + + + +
+ + + -- cgit v1.2.3