diff options
Diffstat (limited to 'Zip/Entry.html')
-rw-r--r-- | Zip/Entry.html | 636 |
1 files changed, 636 insertions, 0 deletions
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 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8" /> + <meta id="repository-name" content="github.com/pablotron/zip-crystal"> + <link href="../css/style.css" rel="stylesheet" type="text/css" /> + <script type="text/javascript" src="../js/doc.js"></script> + <title>Zip::Entry - github.com/pablotron/zip-crystal</title> +</head> +<body> + +<div id="types-list"> + <div id="search-box"> + <input type="search" id="search-input" placeholder="Search..."> + </div> + + <ul> + <li><a href="../index.html">README</a></li> + </ul> + + <ul> + + <li class="parent open current" data-id="github.com/pablotron/zip-crystal/Zip" data-name="zip"> + <a href="../Zip.html">Zip</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Archive" data-name="zip::archive"> + <a href="../Zip/Archive.html">Archive</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/CompressionMethod" data-name="zip::compressionmethod"> + <a href="../Zip/CompressionMethod.html">CompressionMethod</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/DeflateCompressionHelper" data-name="zip::deflatecompressionhelper"> + <a href="../Zip/DeflateCompressionHelper.html">DeflateCompressionHelper</a> + + </li> + + <li class=" current" data-id="github.com/pablotron/zip-crystal/Zip/Entry" data-name="zip::entry"> + <a href="../Zip/Entry.html">Entry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Error" data-name="zip::error"> + <a href="../Zip/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Extra" data-name="zip::extra"> + <a href="../Zip/Extra.html">Extra</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/GeneralFlags" data-name="zip::generalflags"> + <a href="../Zip/GeneralFlags.html">GeneralFlags</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/NoneCompressionHelper" data-name="zip::nonecompressionhelper"> + <a href="../Zip/NoneCompressionHelper.html">NoneCompressionHelper</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Source" data-name="zip::source"> + <a href="../Zip/Source.html">Source</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/TimeHelper" data-name="zip::timehelper"> + <a href="../Zip/TimeHelper.html">TimeHelper</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Version" data-name="zip::version"> + <a href="../Zip/Version.html">Version</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writer" data-name="zip::writer"> + <a href="../Zip/Writer.html">Writer</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> + <a href="../Zip/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + + + </li> + +</ul> + +</div> + +<div id="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> Zip::Entry + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../Zip/Entry.html">Zip::Entry</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>File entry in <code><a href="../Zip/Archive.html">Archive</a></code>.</p> + +<p>Use <code><a href="../Zip.html#read%28slice%3ABytes%2C%26cb%3AArchive-%3E%29%3AVoid-class-method">Zip.read</a>()</code> to read a Zip archive, then <code>#[]</code> to fetch a +specific archive entry.</p> + +<p>Example:</p> + +<p># create MemoryIO +io = MemoryIO.new</p> + +<p># open "foo.zip" +Zip.read("foo.zip") do |zip| +# get "bar.txt" entry from "foo.zip" +e = zip["bar.txt"]</p> + +<pre><code><span class="c"># read contents of "bar.txt" into io</span> +e.read(io)</code></pre> + +<p>end</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../Zip/DeflateCompressionHelper.html">Zip::DeflateCompressionHelper</a></li> + + <li class="other-type"><a href="../Zip/NoneCompressionHelper.html">Zip::NoneCompressionHelper</a></li> + + <li class="other-type"><a href="../Zip/TimeHelper.html">Zip::TimeHelper</a></li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + + + + + <h2>Class Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new%28io%3ASource%29-class-method" class="signature"><strong>.new</strong>(io : Source)</a> + + <div class="summary"><p>Instantiate a new <code><a href="../Zip/Entry.html">Entry</a></code> object from the given IO.</p></div> + + </li> + + </ul> + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#comment%3AString-instance-method" class="signature"><strong>#comment</strong> : String</a> + + </li> + + <li class="entry-summary"> + <a href="#compressed_size%3AUInt32-instance-method" class="signature"><strong>#compressed_size</strong> : UInt32</a> + + </li> + + <li class="entry-summary"> + <a href="#crc%3AUInt32-instance-method" class="signature"><strong>#crc</strong> : UInt32</a> + + </li> + + <li class="entry-summary"> + <a href="#external_attr%3AUInt32-instance-method" class="signature"><strong>#external_attr</strong> : UInt32</a> + + </li> + + <li class="entry-summary"> + <a href="#extras%3AArray%28Zip%3A%3AExtra%29-instance-method" class="signature"><strong>#extras</strong> : Array(Zip::Extra)</a> + + </li> + + <li class="entry-summary"> + <a href="#flags%3AUInt16-instance-method" class="signature"><strong>#flags</strong> : UInt16</a> + + </li> + + <li class="entry-summary"> + <a href="#internal_attr%3AUInt16-instance-method" class="signature"><strong>#internal_attr</strong> : UInt16</a> + + </li> + + <li class="entry-summary"> + <a href="#local_extras%3AArray%28Extra%29-instance-method" class="signature"><strong>#local_extras</strong> : Array(Extra)</a> + + <div class="summary"><p>Returns an array of <code><a href="../Zip/Extra.html">Extra</a></code> attributes for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#method%3AZip%3A%3ACompressionMethod-instance-method" class="signature"><strong>#method</strong> : Zip::CompressionMethod</a> + + </li> + + <li class="entry-summary"> + <a href="#path%3AString-instance-method" class="signature"><strong>#path</strong> : String</a> + + </li> + + <li class="entry-summary"> + <a href="#pos%3AUInt32-instance-method" class="signature"><strong>#pos</strong> : UInt32</a> + + </li> + + <li class="entry-summary"> + <a href="#read%28dst_io%3AIO%29%3AUInt32-instance-method" class="signature"><strong>#read</strong>(dst_io : IO) : UInt32</a> + + <div class="summary"><p>Write contents of <code><a href="../Zip/Entry.html">Entry</a></code> into given <code>IO</code>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#size%3AUInt32-instance-method" class="signature"><strong>#size</strong> : UInt32</a> + + <div class="summary"><p>Return the uncompressed size of this entry in bytes.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#time%3ATime-instance-method" class="signature"><strong>#time</strong> : Time</a> + + </li> + + <li class="entry-summary"> + <a href="#uncompressed_size%3AUInt32-instance-method" class="signature"><strong>#uncompressed_size</strong> : UInt32</a> + + </li> + + <li class="entry-summary"> + <a href="#version%3AUInt16-instance-method" class="signature"><strong>#version</strong> : UInt16</a> + + </li> + + <li class="entry-summary"> + <a href="#version_needed%3AUInt16-instance-method" class="signature"><strong>#version_needed</strong> : UInt16</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Class Method Detail</h2> + + <div class="entry-detail" id="new(io:Source)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(io : <a href="../Zip/Source.html">Source</a>) + + <a class="method-permalink" href="#new%28io%3ASource%29-class-method">#</a> + </div> + + <div class="doc"><p>Instantiate a new <code><a href="../Zip/Entry.html">Entry</a></code> object from the given IO.</p> + +<p>You should not need to call this method directly (use +<code><a href="../Zip/Archive.html#%5B%5D%28path%3AString%29%3AEntry-instance-method">Zip::Archive#[]</a></code> instead).</p></div> + + <br/> + <div> + + </div> + </div> + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="comment:String-instance-method"> + <div class="signature"> + + def <strong>comment</strong> : String + + <a class="method-permalink" href="#comment%3AString-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="compressed_size:UInt32-instance-method"> + <div class="signature"> + + def <strong>compressed_size</strong> : UInt32 + + <a class="method-permalink" href="#compressed_size%3AUInt32-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="crc:UInt32-instance-method"> + <div class="signature"> + + def <strong>crc</strong> : UInt32 + + <a class="method-permalink" href="#crc%3AUInt32-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="external_attr:UInt32-instance-method"> + <div class="signature"> + + def <strong>external_attr</strong> : UInt32 + + <a class="method-permalink" href="#external_attr%3AUInt32-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="extras:Array(Zip::Extra)-instance-method"> + <div class="signature"> + + def <strong>extras</strong> : Array(<a href="../Zip/Extra.html">Zip::Extra</a>) + + <a class="method-permalink" href="#extras%3AArray%28Zip%3A%3AExtra%29-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="flags:UInt16-instance-method"> + <div class="signature"> + + def <strong>flags</strong> : UInt16 + + <a class="method-permalink" href="#flags%3AUInt16-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="internal_attr:UInt16-instance-method"> + <div class="signature"> + + def <strong>internal_attr</strong> : UInt16 + + <a class="method-permalink" href="#internal_attr%3AUInt16-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="local_extras:Array(Extra)-instance-method"> + <div class="signature"> + + def <strong>local_extras</strong> : Array(<a href="../Zip/Extra.html">Extra</a>) + + <a class="method-permalink" href="#local_extras%3AArray%28Extra%29-instance-method">#</a> + </div> + + <div class="doc"><p>Returns an array of <code><a href="../Zip/Extra.html">Extra</a></code> attributes for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p> + +<p>Zip archives can (and do) have separate <code><a href="../Zip/Extra.html">Extra</a></code> attributes +associated with the file entry itself, and the file's entry in the +Central Directory.</p> + +<p>The <code><a href="../Zip/Entry.html#extras%3AArray%28Zip%3A%3AExtra%29-instance-method">#extras</a></code> method returns the <code><a href="../Zip/Extra.html">Extra</a></code> attributes from the +file's entry in the Central Directory, and this method returns the +<code><a href="../Zip/Extra.html">Extra</a></code> data from the file entry itself.</p> + +<p>Example:</p> + +<p># 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</p></div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="method:Zip::CompressionMethod-instance-method"> + <div class="signature"> + + def <strong>method</strong> : <a href="../Zip/CompressionMethod.html">Zip::CompressionMethod</a> + + <a class="method-permalink" href="#method%3AZip%3A%3ACompressionMethod-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="path:String-instance-method"> + <div class="signature"> + + def <strong>path</strong> : String + + <a class="method-permalink" href="#path%3AString-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="pos:UInt32-instance-method"> + <div class="signature"> + + def <strong>pos</strong> : UInt32 + + <a class="method-permalink" href="#pos%3AUInt32-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="read(dst_io:IO):UInt32-instance-method"> + <div class="signature"> + + def <strong>read</strong>(dst_io : IO) : UInt32 + + <a class="method-permalink" href="#read%28dst_io%3AIO%29%3AUInt32-instance-method">#</a> + </div> + + <div class="doc"><p>Write contents of <code><a href="../Zip/Entry.html">Entry</a></code> into given <code>IO</code>.</p> + +<p>Raises an <code><a href="../Zip/Error.html">Error</a></code> if the file contents could not be read or if the +compression method is unsupported.</p> + +<p>Example:</p> + +<p># 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</p></div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="size:UInt32-instance-method"> + <div class="signature"> + + def <strong>size</strong> : UInt32 + + <a class="method-permalink" href="#size%3AUInt32-instance-method">#</a> + </div> + + <div class="doc"><p>Return the uncompressed size of this entry in bytes.</p> + +<p>Example:</p> + +<p>Zip.read("foo.zip") do |zip| +size = zip["bar.txt"].size +puts "bar.txt is #{size} bytes." +end</p></div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="time:Time-instance-method"> + <div class="signature"> + + def <strong>time</strong> : Time + + <a class="method-permalink" href="#time%3ATime-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="uncompressed_size:UInt32-instance-method"> + <div class="signature"> + + def <strong>uncompressed_size</strong> : UInt32 + + <a class="method-permalink" href="#uncompressed_size%3AUInt32-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="version:UInt16-instance-method"> + <div class="signature"> + + def <strong>version</strong> : UInt16 + + <a class="method-permalink" href="#version%3AUInt16-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="version_needed:UInt16-instance-method"> + <div class="signature"> + + def <strong>version_needed</strong> : UInt16 + + <a class="method-permalink" href="#version_needed%3AUInt16-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + + + + +</div> + +</body> +</html> |