diff options
-rw-r--r-- | Zip.html | 32 | ||||
-rw-r--r-- | Zip/Archive.html | 110 | ||||
-rw-r--r-- | Zip/CompressionMethod.html | 24 | ||||
-rw-r--r-- | Zip/DeflateCompressionHelper.html | 26 | ||||
-rw-r--r-- | Zip/Entry.html | 318 | ||||
-rw-r--r-- | Zip/Error.html | 24 | ||||
-rw-r--r-- | Zip/Extra.html | 24 | ||||
-rw-r--r-- | Zip/GeneralFlags.html | 24 | ||||
-rw-r--r-- | Zip/NoneCompressionHelper.html | 26 | ||||
-rw-r--r-- | Zip/Source.html | 24 | ||||
-rw-r--r-- | Zip/TimeHelper.html | 26 | ||||
-rw-r--r-- | Zip/Version.html | 54 | ||||
-rw-r--r-- | Zip/Writer.html | 63 | ||||
-rw-r--r-- | Zip/WriterEntry.html | 319 | ||||
-rw-r--r-- | Zip/Writers/DirEntry.html | 292 | ||||
-rw-r--r-- | Zip/Writers/FileEntry.html | 315 | ||||
-rw-r--r-- | Zip/Writers/WriterEntry.html | 343 | ||||
-rw-r--r-- | index.html | 39 |
18 files changed, 1657 insertions, 426 deletions
@@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -124,7 +144,7 @@ mem_io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k"> <span class="c"># read from "foo.zip"</span> <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> <span class="c"># read contents of "bar.txt" in "foo.zip" into mem_io</span> - zip[<span class="s">"bar.txt"</span>].read(mem_io) + zip[<span class="s">"bar.txt"</span>].write(mem_io) <span class="k">end</span></code></pre> <p>Writing to a zip file:</p> @@ -260,7 +280,7 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <span class="c"># extract "bar.txt" from zip archive in Slice some_slice and</span> <span class="c"># save it to MemoryIO</span> <span class="t">Zip</span>.read(some_slice) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> - zip[<span class="s">"bar.txt"</span>].read(io) + zip[<span class="s">"bar.txt"</span>].write(io) <span class="k">end</span></code></pre></div> <br/> @@ -286,7 +306,7 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <span class="c"># extract "bar.txt" from "foo.zip" and save it to MemoryIO</span> <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> - zip[<span class="s">"bar.txt"</span>].read(io) + zip[<span class="s">"bar.txt"</span>].write(io) <span class="k">end</span></code></pre></div> <br/> @@ -313,7 +333,7 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <span class="c"># read "bar.txt" from "foo.zip"</span> <span class="t">Zip</span>.read(<span class="t">File</span>.open(<span class="s">"foo.zip"</span>, <span class="s">"rb"</span>)) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> - zip[<span class="s">"bar.txt"</span>].read(io) + zip[<span class="s">"bar.txt"</span>].write(io) <span class="k">end</span></code></pre></div> <br/> diff --git a/Zip/Archive.html b/Zip/Archive.html index 332b0f1..cb75fac 100644 --- a/Zip/Archive.html +++ b/Zip/Archive.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -195,31 +215,43 @@ <li class="entry-summary"> <a href="#comment%3AString-instance-method" class="signature"><strong>#comment</strong> : String</a> + <div class="summary"><p>Get the <code><a href="../Zip/Archive.html">Archive</a></code> comment as a String.</p></div> + </li> <li class="entry-summary"> <a href="#each%28%2Aargs%2C%2A%2Aoptions%2C%26block%29-instance-method" class="signature"><strong>#each</strong>(*args, **options, &block)</a> + <div class="summary"><p>Iterate over the entries in this <code><a href="../Zip/Archive.html">Archive</a></code>, or, if called without a block, return a lazy iterator.</p></div> + </li> <li class="entry-summary"> <a href="#each%28%2Aargs%2C%2A%2Aoptions%29-instance-method" class="signature"><strong>#each</strong>(*args, **options)</a> + <div class="summary"><p>Iterate over the entries in this <code><a href="../Zip/Archive.html">Archive</a></code>, or, if called without a block, return a lazy iterator.</p></div> + </li> <li class="entry-summary"> <a href="#entries%3AArray%28Zip%3A%3AEntry%29-instance-method" class="signature"><strong>#entries</strong> : Array(Zip::Entry)</a> + <div class="summary"><p>Return an array of entries in this Archive.</p></div> + </li> <li class="entry-summary"> <a href="#size%28%2Aargs%2C%2A%2Aoptions%2C%26block%29-instance-method" class="signature"><strong>#size</strong>(*args, **options, &block)</a> + <div class="summary"><p>Return the number of entries in this <code><a href="../Zip/Archive.html">Archive</a></code>.</p></div> + </li> <li class="entry-summary"> <a href="#size%28%2Aargs%2C%2A%2Aoptions%29-instance-method" class="signature"><strong>#size</strong>(*args, **options)</a> + <div class="summary"><p>Return the number of entries in this <code><a href="../Zip/Archive.html">Archive</a></code>.</p></div> + </li> </ul> @@ -298,9 +330,9 @@ <p>Example:</p> -<pre><code><span class="c"># get bar.txt and read it into memory io</span> +<pre><code><span class="c"># get bar.txt and write it into memory io</span> io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span> -zip[<span class="s">"bar.txt"</span>].read(io)</code></pre></div> +zip[<span class="s">"bar.txt"</span>].write(io)</code></pre></div> <br/> <div> @@ -320,9 +352,9 @@ zip[<span class="s">"bar.txt"</span>].read(io)</code></pre></div> <p>Example:</p> -<pre><code><span class="c"># read third entry from archive into memory io</span> +<pre><code><span class="c"># write contents of third entry from archive into memory io</span> io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span> -zip[<span class="n">2</span>].read(io)</code></pre></div> +zip[<span class="n">2</span>].write(io)</code></pre></div> <br/> <div> @@ -342,10 +374,10 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <p>Example:</p> -<pre><code><span class="c"># read third entry from archive into memory io</span> +<pre><code><span class="c"># write contents of third entry from archive into memory io</span> <span class="k">if</span> e <span class="o">=</span> zip[<span class="n">2</span>]? io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span> - e.read(io) + e.write(io) <span class="k">end</span></code></pre></div> <br/> @@ -366,10 +398,10 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <p>Example:</p> -<pre><code><span class="c"># read bar.txt into memory io if it exists</span> +<pre><code><span class="c"># write contents of "bar.txt" into memory io if it exists</span> <span class="k">if</span> e <span class="o">=</span> zip[<span class="s">"bar.txt"</span>]? io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span> - e.read(io) + e.write(io) <span class="k">end</span></code></pre></div> <br/> @@ -386,6 +418,15 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <a class="method-permalink" href="#comment%3AString-instance-method">#</a> </div> + <div class="doc"><p>Get the <code><a href="../Zip/Archive.html">Archive</a></code> comment as a String.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print archive comment</span> + puts <span class="s">"comment: </span><span class="i">#{</span></span>zip.comment<span class="s"><span class="i">}</span>"</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -400,6 +441,18 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <a class="method-permalink" href="#each%28%2Aargs%2C%2A%2Aoptions%2C%26block%29-instance-method">#</a> </div> + <div class="doc"><p>Iterate over the entries in this <code><a href="../Zip/Archive.html">Archive</a></code>, or, if called without +a block, return a lazy iterator.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + <span class="k">type</span> <span class="o">=</span> e.dir? ? <span class="s">"directory"</span> : <span class="s">"file"</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> is a </span><span class="i">#{</span></span><span class="k">type</span><span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -414,6 +467,18 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <a class="method-permalink" href="#each%28%2Aargs%2C%2A%2Aoptions%29-instance-method">#</a> </div> + <div class="doc"><p>Iterate over the entries in this <code><a href="../Zip/Archive.html">Archive</a></code>, or, if called without +a block, return a lazy iterator.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + <span class="k">type</span> <span class="o">=</span> e.dir? ? <span class="s">"directory"</span> : <span class="s">"file"</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> is a </span><span class="i">#{</span></span><span class="k">type</span><span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -428,6 +493,15 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <a class="method-permalink" href="#entries%3AArray%28Zip%3A%3AEntry%29-instance-method">#</a> </div> + <div class="doc"><p>Return an array of entries in this Archive.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># get an array of entries in this archive</span> + entries <span class="o">=</span> zip.entries +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -442,6 +516,14 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <a class="method-permalink" href="#size%28%2Aargs%2C%2A%2Aoptions%2C%26block%29-instance-method">#</a> </div> + <div class="doc"><p>Return the number of entries in this <code><a href="../Zip/Archive.html">Archive</a></code>.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + puts <span class="s">"foo.zip has </span><span class="i">#{</span></span>zip.size<span class="s"><span class="i">}</span> entries"</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -456,6 +538,14 @@ zip[<span class="n">2</span>].read(io)</code></pre></div> <a class="method-permalink" href="#size%28%2Aargs%2C%2A%2Aoptions%29-instance-method">#</a> </div> + <div class="doc"><p>Return the number of entries in this <code><a href="../Zip/Archive.html">Archive</a></code>.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + puts <span class="s">"foo.zip has </span><span class="i">#{</span></span>zip.size<span class="s"><span class="i">}</span> entries"</span> +<span class="k">end</span></code></pre></div> + <br/> <div> diff --git a/Zip/CompressionMethod.html b/Zip/CompressionMethod.html index f18b338..83b022f 100644 --- a/Zip/CompressionMethod.html +++ b/Zip/CompressionMethod.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> diff --git a/Zip/DeflateCompressionHelper.html b/Zip/DeflateCompressionHelper.html index 0b42f24..6daf337 100644 --- a/Zip/DeflateCompressionHelper.html +++ b/Zip/DeflateCompressionHelper.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -129,7 +149,7 @@ <li class="other-type"><a href="../Zip/Entry.html">Zip::Entry</a></li> - <li class="other-type"><a href="../Zip/WriterEntry.html">Zip::WriterEntry</a></li> + <li class="other-type"><a href="../Zip/Writers/FileEntry.html">Zip::Writers::FileEntry</a></li> </ul> 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 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -184,35 +204,56 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <li class="entry-summary"> <a href="#comment%3AString-instance-method" class="signature"><strong>#comment</strong> : String</a> + <div class="summary"><p>Get comment for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>String</code>.</p></div> + </li> <li class="entry-summary"> <a href="#compressed_size%3AUInt32-instance-method" class="signature"><strong>#compressed_size</strong> : UInt32</a> + <div class="summary"><p>Get compressed size for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p></div> + </li> <li class="entry-summary"> <a href="#crc%3AUInt32-instance-method" class="signature"><strong>#crc</strong> : UInt32</a> + <div class="summary"><p>Get CRC-32 for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#dir%3F%3ABool-instance-method" class="signature"><strong>#dir?</strong> : Bool</a> + + <div class="summary"><p>Returns true if this entry a directory.</p></div> + </li> <li class="entry-summary"> - <a href="#external_attr%3AUInt32-instance-method" class="signature"><strong>#external_attr</strong> : UInt32</a> + <a href="#external%3AUInt32-instance-method" class="signature"><strong>#external</strong> : UInt32</a> + + <div class="summary"><p>Get external attributes for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p></div> </li> <li class="entry-summary"> <a href="#extras%3AArray%28Zip%3A%3AExtra%29-instance-method" class="signature"><strong>#extras</strong> : Array(Zip::Extra)</a> + <div class="summary"><p>Get <code><a href="../Zip/Extra.html">Extra</a></code> data for this <code><a href="../Zip/Entry.html">Entry</a></code> as an <code>Array</code>.</p></div> + </li> <li class="entry-summary"> <a href="#flags%3AUInt16-instance-method" class="signature"><strong>#flags</strong> : UInt16</a> + <div class="summary"><p>Get <code><a href="../Zip/GeneralFlags.html">GeneralFlags</a></code> for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p></div> + </li> <li class="entry-summary"> - <a href="#internal_attr%3AUInt16-instance-method" class="signature"><strong>#internal_attr</strong> : UInt16</a> + <a href="#internal%3AUInt16-instance-method" class="signature"><strong>#internal</strong> : UInt16</a> + + <div class="summary"><p>Get internal attributes for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt16</code>.</p></div> </li> @@ -226,49 +267,63 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <li class="entry-summary"> <a href="#method%3AZip%3A%3ACompressionMethod-instance-method" class="signature"><strong>#method</strong> : Zip::CompressionMethod</a> + <div class="summary"><p>Get <code><a href="../Zip/CompressionMethod.html">CompressionMethod</a></code> for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p></div> + </li> <li class="entry-summary"> <a href="#path%3AString-instance-method" class="signature"><strong>#path</strong> : String</a> + <div class="summary"><p>Get path for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>String</code>.</p></div> + </li> <li class="entry-summary"> <a href="#pos%3AUInt32-instance-method" class="signature"><strong>#pos</strong> : UInt32</a> + <div class="summary"><p>Get position for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p></div> + </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> + <a href="#size%3AUInt32-instance-method" class="signature"><strong>#size</strong> : 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> + <div class="summary"><p>Get uncompressed size for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p></div> </li> <li class="entry-summary"> - <a href="#size%3AUInt32-instance-method" class="signature"><strong>#size</strong> : UInt32</a> + <a href="#time%3ATime-instance-method" class="signature"><strong>#time</strong> : Time</a> - <div class="summary"><p>Return the uncompressed size of this entry in bytes.</p></div> + <div class="summary"><p>Get <code>Time</code> for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p></div> </li> <li class="entry-summary"> - <a href="#time%3ATime-instance-method" class="signature"><strong>#time</strong> : Time</a> + <a href="#version%3AUInt16-instance-method" class="signature"><strong>#version</strong> : UInt16</a> + + <div class="summary"><p>Get <code><a href="../Zip/Version.html">Version</a></code> used to generate this <code><a href="../Zip/Entry.html">Entry</a></code>.</p></div> </li> <li class="entry-summary"> - <a href="#uncompressed_size%3AUInt32-instance-method" class="signature"><strong>#uncompressed_size</strong> : UInt32</a> + <a href="#version_needed%3AUInt16-instance-method" class="signature"><strong>#version_needed</strong> : UInt16</a> + + <div class="summary"><p>Get <code><a href="../Zip/Version.html">Version</a></code> needed to generate this <code><a href="../Zip/Entry.html">Entry</a></code>.</p></div> </li> <li class="entry-summary"> - <a href="#version%3AUInt16-instance-method" class="signature"><strong>#version</strong> : UInt16</a> + <a href="#write%28path%3AString%29%3AUInt32-instance-method" class="signature"><strong>#write</strong>(path : String) : UInt32</a> + + <div class="summary"><p>Write contents of <code><a href="../Zip/Entry.html">Entry</a></code> into given path <em>path</em> and return the number of bytes written.</p></div> </li> <li class="entry-summary"> - <a href="#version_needed%3AUInt16-instance-method" class="signature"><strong>#version_needed</strong> : UInt16</a> + <a href="#write%28dst_io%3AIO%29%3AUInt32-instance-method" class="signature"><strong>#write</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> @@ -352,6 +407,15 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <a class="method-permalink" href="#comment%3AString-instance-method">#</a> </div> + <div class="doc"><p>Get comment for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>String</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print comment for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> comment: </span><span class="i">#{</span></span>e.comment<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -366,6 +430,15 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <a class="method-permalink" href="#compressed_size%3AUInt32-instance-method">#</a> </div> + <div class="doc"><p>Get compressed size for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print compressed size for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> compressed size: </span><span class="i">#{</span></span>e.compressed_size<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -380,20 +453,61 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <a class="method-permalink" href="#crc%3AUInt32-instance-method">#</a> </div> + <div class="doc"><p>Get CRC-32 for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print crc for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> CRC-32: </span><span class="i">#{</span></span>e.crc<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> </div> </div> - <div class="entry-detail" id="external_attr:UInt32-instance-method"> + <div class="entry-detail" id="dir?:Bool-instance-method"> <div class="signature"> - def <strong>external_attr</strong> : UInt32 + def <strong>dir?</strong> : Bool - <a class="method-permalink" href="#external_attr%3AUInt32-instance-method">#</a> + <a class="method-permalink" href="#dir%3F%3ABool-instance-method">#</a> </div> + <div class="doc"><p>Returns true if this entry a directory.</p> + +<p>Example:</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="k">type</span> <span class="o">=</span> zip[<span class="s">"some-dir/"</span>].dir? ? <span class="s">"directory"</span> : <span class="s">"file"</span> + puts <span class="s">"</span><span class="i">#{</span></span>path<span class="s"><span class="i">}</span> is a </span><span class="i">#{</span></span><span class="k">type</span><span class="s"><span class="i">}</span>"</span> +<span class="k">end</span></code></pre></div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="external:UInt32-instance-method"> + <div class="signature"> + + def <strong>external</strong> : UInt32 + + <a class="method-permalink" href="#external%3AUInt32-instance-method">#</a> + </div> + + <div class="doc"><p>Get external attributes for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print external attributes for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> external attributes: </span><span class="i">#{</span></span>e.external<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -408,6 +522,15 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <a class="method-permalink" href="#extras%3AArray%28Zip%3A%3AExtra%29-instance-method">#</a> </div> + <div class="doc"><p>Get <code><a href="../Zip/Extra.html">Extra</a></code> data for this <code><a href="../Zip/Entry.html">Entry</a></code> as an <code>Array</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print number of extra data items for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> extras: </span><span class="i">#{</span></span>e.extras.size<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -422,20 +545,38 @@ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new< <a class="method-permalink" href="#flags%3AUInt16-instance-method">#</a> </div> + <div class="doc"><p>Get <code><a href="../Zip/GeneralFlags.html">GeneralFlags</a></code> for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print flags for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> flags: </span><span class="i">#{</span></span>e.flags<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> </div> </div> - <div class="entry-detail" id="internal_attr:UInt16-instance-method"> + <div class="entry-detail" id="internal:UInt16-instance-method"> <div class="signature"> - def <strong>internal_attr</strong> : UInt16 + def <strong>internal</strong> : UInt16 - <a class="method-permalink" href="#internal_attr%3AUInt16-instance-method">#</a> + <a class="method-permalink" href="#internal%3AUInt16-instance-method">#</a> </div> + <div class="doc"><p>Get internal attributes for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt16</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print internal attributes for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> internal attributes: </span><span class="i">#{</span></span>e.internal<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -482,6 +623,15 @@ file's entry in the Central Directory, and this method returns the <a class="method-permalink" href="#method%3AZip%3A%3ACompressionMethod-instance-method">#</a> </div> + <div class="doc"><p>Get <code><a href="../Zip/CompressionMethod.html">CompressionMethod</a></code> for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print compression method for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> compression method: </span><span class="i">#{</span></span>e.method<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -496,6 +646,15 @@ file's entry in the Central Directory, and this method returns the <a class="method-permalink" href="#path%3AString-instance-method">#</a> </div> + <div class="doc"><p>Get path for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>String</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print uncompressed size for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> @@ -510,33 +669,35 @@ file's entry in the Central Directory, and this method returns the <a class="method-permalink" href="#pos%3AUInt32-instance-method">#</a> </div> + <div class="doc"><p>Get position for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print position for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> position: </span><span class="i">#{</span></span>e.pos<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> </div> </div> - <div class="entry-detail" id="read(dst_io:IO):UInt32-instance-method"> + <div class="entry-detail" id="size:UInt32-instance-method"> <div class="signature"> - def <strong>read</strong>(dst_io : IO) : UInt32 + def <strong>size</strong> : UInt32 - <a class="method-permalink" href="#read%28dst_io%3AIO%29%3AUInt32-instance-method">#</a> + <a class="method-permalink" href="#size%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> + <div class="doc"><p>Get uncompressed size for this <code><a href="../Zip/Entry.html">Entry</a></code> as a <code>UInt32</code>.</p> -<p>Example:</p> - -<pre><code><span class="c"># open "output-bar.txt" for writing</span> -<span class="t">File</span>.open(<span class="s">"output-bar.txt"</span>, <span class="s">"wb"</span>) <span class="k">do</span> <span class="o">|</span>io<span class="o">|</span> - <span class="c"># open archive "./foo.zip"</span> - <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> - <span class="c"># write contents of "bar.txt" to "output-bar.txt"</span> - zip[<span class="s">"foo.txt"</span>].read(io) +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print uncompressed size for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> uncompressed size: </span><span class="i">#{</span></span>e.size<span class="s"><span class="i">}</span>"</span> <span class="k">end</span> <span class="k">end</span></code></pre></div> @@ -546,21 +707,21 @@ compression method is unsupported.</p> </div> </div> - <div class="entry-detail" id="size:UInt32-instance-method"> + <div class="entry-detail" id="time:Time-instance-method"> <div class="signature"> - def <strong>size</strong> : UInt32 + def <strong>time</strong> : Time - <a class="method-permalink" href="#size%3AUInt32-instance-method">#</a> + <a class="method-permalink" href="#time%3ATime-instance-method">#</a> </div> - <div class="doc"><p>Return the uncompressed size of this entry in bytes.</p> - -<p>Example:</p> + <div class="doc"><p>Get <code>Time</code> for this <code><a href="../Zip/Entry.html">Entry</a></code>.</p> <pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> - size <span class="o">=</span> zip[<span class="s">"bar.txt"</span>].size - puts <span class="s">"bar.txt is </span><span class="i">#{</span></span>size<span class="s"><span class="i">}</span> bytes."</span> + <span class="c"># print time for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> time: </span><span class="i">#{</span></span>e.time<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> <span class="k">end</span></code></pre></div> <br/> @@ -569,56 +730,107 @@ compression method is unsupported.</p> </div> </div> - <div class="entry-detail" id="time:Time-instance-method"> + <div class="entry-detail" id="version:UInt16-instance-method"> <div class="signature"> - def <strong>time</strong> : Time + def <strong>version</strong> : UInt16 - <a class="method-permalink" href="#time%3ATime-instance-method">#</a> + <a class="method-permalink" href="#version%3AUInt16-instance-method">#</a> </div> + <div class="doc"><p>Get <code><a href="../Zip/Version.html">Version</a></code> used to generate this <code><a href="../Zip/Entry.html">Entry</a></code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print version used for each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> version used: </span><span class="i">#{</span></span>e.version<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> </div> </div> - <div class="entry-detail" id="uncompressed_size:UInt32-instance-method"> + <div class="entry-detail" id="version_needed:UInt16-instance-method"> <div class="signature"> - def <strong>uncompressed_size</strong> : UInt32 + def <strong>version_needed</strong> : UInt16 - <a class="method-permalink" href="#uncompressed_size%3AUInt32-instance-method">#</a> + <a class="method-permalink" href="#version_needed%3AUInt16-instance-method">#</a> </div> + <div class="doc"><p>Get <code><a href="../Zip/Version.html">Version</a></code> needed to generate this <code><a href="../Zip/Entry.html">Entry</a></code>.</p> + +<pre><code><span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># print version needed to extract each entry</span> + zip.each <span class="k">do</span> <span class="o">|</span>e<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span></span>e.path<span class="s"><span class="i">}</span> version needed: </span><span class="i">#{</span></span>e.version_needed<span class="s"><span class="i">}</span>"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> </div> </div> - <div class="entry-detail" id="version:UInt16-instance-method"> + <div class="entry-detail" id="write(path:String):UInt32-instance-method"> <div class="signature"> - def <strong>version</strong> : UInt16 + def <strong>write</strong>(path : String) : UInt32 - <a class="method-permalink" href="#version%3AUInt16-instance-method">#</a> + <a class="method-permalink" href="#write%28path%3AString%29%3AUInt32-instance-method">#</a> </div> + <div class="doc"><p>Write contents of <code><a href="../Zip/Entry.html">Entry</a></code> into given path <em>path</em> and return the +number of bytes written.</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> + +<pre><code><span class="c"># open "output-bar.txt" for writing</span> +<span class="t">File</span>.open(<span class="s">"output-bar.txt"</span>, <span class="s">"wb"</span>) <span class="k">do</span> <span class="o">|</span>io<span class="o">|</span> + <span class="c"># open archive "./foo.zip"</span> + <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># write contents of "bar.txt" to "output-bar.txt"</span> + zip[<span class="s">"foo.txt"</span>].write(io) + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> </div> </div> - <div class="entry-detail" id="version_needed:UInt16-instance-method"> + <div class="entry-detail" id="write(dst_io:IO):UInt32-instance-method"> <div class="signature"> - def <strong>version_needed</strong> : UInt16 + def <strong>write</strong>(dst_io : IO) : UInt32 - <a class="method-permalink" href="#version_needed%3AUInt16-instance-method">#</a> + <a class="method-permalink" href="#write%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> + +<pre><code><span class="c"># open "output-bar.txt" for writing</span> +<span class="t">File</span>.open(<span class="s">"output-bar.txt"</span>, <span class="s">"wb"</span>) <span class="k">do</span> <span class="o">|</span>io<span class="o">|</span> + <span class="c"># open archive "./foo.zip"</span> + <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># write contents of "bar.txt" to "output-bar.txt"</span> + zip[<span class="s">"foo.txt"</span>].write(io) + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + <br/> <div> diff --git a/Zip/Error.html b/Zip/Error.html index d2a611e..6aeba81 100644 --- a/Zip/Error.html +++ b/Zip/Error.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> diff --git a/Zip/Extra.html b/Zip/Extra.html index 3ea15f3..554e82b 100644 --- a/Zip/Extra.html +++ b/Zip/Extra.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> diff --git a/Zip/GeneralFlags.html b/Zip/GeneralFlags.html index 4831e42..8778ab7 100644 --- a/Zip/GeneralFlags.html +++ b/Zip/GeneralFlags.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> diff --git a/Zip/NoneCompressionHelper.html b/Zip/NoneCompressionHelper.html index f508f52..b8b8be6 100644 --- a/Zip/NoneCompressionHelper.html +++ b/Zip/NoneCompressionHelper.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -129,7 +149,7 @@ <li class="other-type"><a href="../Zip/Entry.html">Zip::Entry</a></li> - <li class="other-type"><a href="../Zip/WriterEntry.html">Zip::WriterEntry</a></li> + <li class="other-type"><a href="../Zip/Writers/FileEntry.html">Zip::Writers::FileEntry</a></li> </ul> diff --git a/Zip/Source.html b/Zip/Source.html index 6c94cbc..894aef1 100644 --- a/Zip/Source.html +++ b/Zip/Source.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> diff --git a/Zip/TimeHelper.html b/Zip/TimeHelper.html index ed3ffad..de19300 100644 --- a/Zip/TimeHelper.html +++ b/Zip/TimeHelper.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -129,7 +149,7 @@ <li class="other-type"><a href="../Zip/Entry.html">Zip::Entry</a></li> - <li class="other-type"><a href="../Zip/WriterEntry.html">Zip::WriterEntry</a></li> + <li class="other-type"><a href="../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></li> </ul> diff --git a/Zip/Version.html b/Zip/Version.html index a555534..f8a04b4 100644 --- a/Zip/Version.html +++ b/Zip/Version.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -120,6 +140,12 @@ attributes.</p> <p>See section 4.4.3.2 of APPNOTE.TXT for version details.</p> +<p>Example:</p> + +<pre><code><span class="c"># create version and print it out</span> +version <span class="o">=</span> <span class="t">Zip</span><span class="t">::</span><span class="t">Version</span>.<span class="k">new</span>(<span class="n">5</span>, <span class="n">0</span>) +puts <span class="s">"version = </span><span class="i">#{</span></span>version<span class="s"><span class="i">}</span>"</span></code></pre> + @@ -239,7 +265,13 @@ attributes.</p> </div> <div class="doc"><p>Create a version identifier from a major number, minor number, and -optional compatability number.</p></div> +optional compatability number.</p> + +<p>Example:</p> + +<pre><code><span class="c"># create version and print it out</span> +version <span class="o">=</span> <span class="t">Zip</span><span class="t">::</span><span class="t">Version</span>.<span class="k">new</span>(<span class="n">5</span>, <span class="n">0</span>) +puts <span class="s">"version = </span><span class="i">#{</span></span>version<span class="s"><span class="i">}</span>"</span></code></pre></div> <br/> <div> @@ -256,7 +288,10 @@ optional compatability number.</p></div> </div> <div class="doc"><p>Create a version identifier from a major number, minor number, and -optional compatability number.</p></div> +optional compatability number.</p> + +<p>You shouldn't need to call this constructor directly; it is used +by internal classes.</p></div> <br/> <div> @@ -278,7 +313,10 @@ optional compatability number.</p></div> </div> <div class="doc"><p>Write version as 16-bit, little-endian integer and return number -of bytes written.</p></div> +of bytes written.</p> + +<p>You shouldn't need to call this method directly; it is used by +internal classes.</p></div> <br/> <div> @@ -294,7 +332,11 @@ of bytes written.</p></div> <a class="method-permalink" href="#to_s%28io%29-instance-method">#</a> </div> - <div class="doc"><p>Write version as string.</p></div> + <div class="doc"><p>Write version as string.</p> + +<pre><code><span class="c"># create version and print it out</span> +version <span class="o">=</span> <span class="t">Zip</span><span class="t">::</span><span class="t">Version</span>.<span class="k">new</span>(<span class="n">5</span>, <span class="n">0</span>) +puts <span class="s">"version = </span><span class="i">#{</span></span>version<span class="s"><span class="i">}</span>"</span></code></pre></div> <br/> <div> diff --git a/Zip/Writer.html b/Zip/Writer.html index 894055d..0b4a935 100644 --- a/Zip/Writer.html +++ b/Zip/Writer.html @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="../Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -112,6 +132,13 @@ + <h2>Overview</h2> + + <p>Zip file writer.</p> + +<p>You shouldn't need to instantiate this class directly; use +<code><a href="../Zip.html#write%28io%3AIO%2Cpos%3AUInt32%3D%3Cspanclass%3D%22n%22%3E0_u32%3C%2Fspan%3E%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%2C%26cb%3AWriter-%3E%29%3AUInt32-class-method">Zip.write</a>()</code> instead.</p> + @@ -164,6 +191,13 @@ </li> <li class="entry-summary"> + <a href="#add_dir%28path%3AString%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method" class="signature"><strong>#add_dir</strong>(path : String, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>) : UInt32</a> + + <div class="summary"><p>Add empty directory to archive as <em>path</em> and return number of bytes written.</p></div> + + </li> + + <li class="entry-summary"> <a href="#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method" class="signature"><strong>#add_file</strong>(path : String, file_path : String, method : CompressionMethod = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>) : UInt32</a> <div class="summary"><p>Add local file <em>file_path</em> to archive as <em>path</em> and return number of bytes written.</p></div> @@ -295,6 +329,31 @@ written.</p> </div> </div> + <div class="entry-detail" id="add_dir(path:String,time:Time=<spanclass="t">Time</span>.now,comment:String=<spanclass="s">&quot;&quot;</span>):UInt32-instance-method"> + <div class="signature"> + + def <strong>add_dir</strong>(path : String, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>) : UInt32 + + <a class="method-permalink" href="#add_dir%28path%3AString%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">#</a> + </div> + + <div class="doc"><p>Add empty directory to archive as <em>path</em> and return number of +bytes written.</p> + +<p>Example:</p> + +<pre><code><span class="c"># write to "foo.zip"</span> +<span class="t">Zip</span>.write(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># add a directory named "example-dir"</span> + zip.add_dir(<span class="s">"example-dir"</span>) +<span class="k">end</span></code></pre></div> + + <br/> + <div> + + </div> + </div> + <div class="entry-detail" id="add_file(path:String,file_path:String,method:CompressionMethod=<spanclass="t">CompressionMethod</span><spanclass="t">::</span><spanclass="t">DEFLATE</span>,time:Time=<spanclass="t">Time</span>.now,comment:String=<spanclass="s">&quot;&quot;</span>):UInt32-instance-method"> <div class="signature"> diff --git a/Zip/WriterEntry.html b/Zip/WriterEntry.html deleted file mode 100644 index 843b04b..0000000 --- a/Zip/WriterEntry.html +++ /dev/null @@ -1,319 +0,0 @@ -<!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::WriterEntry - 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=" " 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=" current" 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::WriterEntry - -</h1> - - - <ul class="superclass-hierarchy"><li class="superclass"><a href="../Zip/WriterEntry.html">Zip::WriterEntry</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> - - - - - <h2>Overview</h2> - - <p>Internal class used to store files for <code><a href="../Zip/Writer.html">Writer</a></code> instance.</p> - -<p>You should not need to instantiate this class directly; it is called -automatically by <code><a href="../Zip/Writer.html#add%28path%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add</a></code> and <code><a href="../Zip/Writer.html#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_file</a></code>.</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>Constant Summary</h2> - - <dl> - - <dt class="entry-const" id="GENERAL_FLAGS"> - <strong>GENERAL_FLAGS</strong> = <code><span class="t">GeneralFlags</span>.flags(<span class="t">FOOTER</span>, <span class="t">EFS</span>)</code> - </dt> - - <dd class="entry-const-doc"> - <p>Default flags for local and central header.</p> - </dd> - - - </dl> - - - - <h2>Class Method Summary</h2> - <ul class="list-summary"> - - <li class="entry-summary"> - <a href="#new%28pos%3AUInt32%2Cpath%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29-class-method" class="signature"><strong>.new</strong>(pos : UInt32, path : String, io : IO, method : CompressionMethod = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>)</a> - - <div class="summary"><p>Create a new WriterEntry instance.</p></div> - - </li> - - </ul> - - - - <h2>Instance Method Summary</h2> - <ul class="list-summary"> - - <li class="entry-summary"> - <a href="#to_s%28dst_io%29%3AUInt32-instance-method" class="signature"><strong>#to_s</strong>(dst_io) : UInt32</a> - - <div class="summary"><p>Write local file entry to IO and return the number of bytes written.</p></div> - - </li> - - <li class="entry-summary"> - <a href="#write_central%28io%3AIO%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%29%3AUInt32-instance-method" class="signature"><strong>#write_central</strong>(io : IO, version : Version = <span class="t">Version</span><span class="t">::</span><span class="t">DEFAULT</span>) : UInt32</a> - - <div class="summary"><p>Write central directory data for this <code><a href="../Zip/WriterEntry.html">WriterEntry</a></code> and return the number of bytes written.</p></div> - - </li> - - </ul> - - - - - -<div class="methods-inherited"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</div> - - - <h2>Class Method Detail</h2> - - <div class="entry-detail" id="new(pos:UInt32,path:String,io:IO,method:CompressionMethod=<spanclass="t">CompressionMethod</span><spanclass="t">::</span><spanclass="t">DEFLATE</span>,time:Time=<spanclass="t">Time</span>.now,comment:String=<spanclass="s">&quot;&quot;</span>)-class-method"> - <div class="signature"> - - def self.<strong>new</strong>(pos : UInt32, path : String, io : IO, method : <a href="../Zip/CompressionMethod.html">CompressionMethod</a> = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>) - - <a class="method-permalink" href="#new%28pos%3AUInt32%2Cpath%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29-class-method">#</a> - </div> - - <div class="doc"><p>Create a new WriterEntry instance.</p> - -<p>You should not need to call this method directly; it is called -automatically by <code><a href="../Zip/Writer.html#add%28path%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add</a></code> and <code><a href="../Zip/Writer.html#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_file</a></code>.</p></div> - - <br/> - <div> - - </div> - </div> - - - - - <h2>Instance Method Detail</h2> - - <div class="entry-detail" id="to_s(dst_io):UInt32-instance-method"> - <div class="signature"> - - def <strong>to_s</strong>(dst_io) : UInt32 - - <a class="method-permalink" href="#to_s%28dst_io%29%3AUInt32-instance-method">#</a> - </div> - - <div class="doc"><p>Write local file entry to IO and return the number of bytes -written.</p> - -<p>You should not need to call this method directly; it is called -automatically by <code><a href="../Zip/Writer.html#add%28path%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add</a></code> and <code><a href="../Zip/Writer.html#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_file</a></code>.</p></div> - - <br/> - <div> - - </div> - </div> - - <div class="entry-detail" id="write_central(io:IO,version:Version=<spanclass="t">Version</span><spanclass="t">::</span><spanclass="t">DEFAULT</span>):UInt32-instance-method"> - <div class="signature"> - - def <strong>write_central</strong>(io : IO, version : <a href="../Zip/Version.html">Version</a> = <span class="t">Version</span><span class="t">::</span><span class="t">DEFAULT</span>) : UInt32 - - <a class="method-permalink" href="#write_central%28io%3AIO%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%29%3AUInt32-instance-method">#</a> - </div> - - <div class="doc"><p>Write central directory data for this <code><a href="../Zip/WriterEntry.html">WriterEntry</a></code> and return the -number of bytes written.</p> - -<p>You should not need to call this method directly; it is called -automatically by <code><a href="../Zip/Writer.html#close-instance-method">Writer#close</a></code>.</p></div> - - <br/> - <div> - - </div> - </div> - - - - - -</div> - -</body> -</html> diff --git a/Zip/Writers/DirEntry.html b/Zip/Writers/DirEntry.html new file mode 100644 index 0000000..a98b19c --- /dev/null +++ b/Zip/Writers/DirEntry.html @@ -0,0 +1,292 @@ +<!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::Writers::DirEntry - 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=" " 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="parent open current" data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" current" data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + + + </li> + +</ul> + + + </li> + +</ul> + +</div> + +<div id="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> Zip::Writers::DirEntry + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../Zip/Writers/DirEntry.html">Zip::Writers::DirEntry</a></li><li class="superclass"><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Internal class used to store files for <code><a href="../../Zip/Writer.html">Writer</a></code> instance.</p> + +<p>You should not need to instantiate this class directly; use +<code><a href="../../Zip/Writer.html#add_dir%28path%3AString%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_dir</a></code> instead.</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + + + + <h2>Constant Summary</h2> + + <dl> + + <dt class="entry-const" id="FLAGS"> + <strong>FLAGS</strong> = <code><span class="t">GeneralFlags</span>.flags(<span class="t">EFS</span>)</code> + </dt> + + <dd class="entry-const-doc"> + <p>Default flags for local and central file header.</p> + </dd> + + + </dl> + + + + <h2>Class Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new%28pos%3AUInt32%2Cpath%3AString%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29-class-method" class="signature"><strong>.new</strong>(pos : UInt32, path : String, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>)</a> + + <div class="summary"><p>Create a new DirEntry instance.</p></div> + + </li> + + </ul> + + + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from class <code><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></code></h3> + + + <a href="../../Zip/Writers/WriterEntry.html#to_s%28dst_io%29%3AUInt32-instance-method" class="tooltip"> + <span>to_s(dst_io) : UInt32</span> + to_s</a>, + + + <a href="../../Zip/Writers/WriterEntry.html#write_body%28dst_io%3AIO%29-instance-method" class="tooltip"> + <span>write_body(dst_io : IO)</span> + write_body</a>, + + + <a href="../../Zip/Writers/WriterEntry.html#write_central%28io%3AIO%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%29%3AUInt32-instance-method" class="tooltip"> + <span>write_central(io : IO, version : Version = <span class="t">Version</span><span class="t">::</span><span class="t">DEFAULT</span>) : UInt32</span> + write_central</a>, + + + <a href="../../Zip/Writers/WriterEntry.html#write_footer%28io%3AIO%2Ccrc%3AUInt32%2Csrc_len%3AUInt32%2Cdst_len%3AUInt32%29%3AUInt32-instance-method" class="tooltip"> + <span>write_footer(io : IO, crc : UInt32, src_len : UInt32, dst_len : UInt32) : UInt32</span> + write_footer</a> + + + + + + + <h3>Class methods inherited from class <code><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></code></h3> + + + <a href="../../Zip/Writers/WriterEntry.html#new%28pos%3AUInt32%2Cpath%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%2Cflags%3AGeneralFlags%3D%3Cspanclass%3D%22t%22%3EGeneralFlags%3C%2Fspan%3E.flags%2Cexternal%3AUInt32%3D%3Cspanclass%3D%22n%22%3E0_u32%3C%2Fspan%3E%29-class-method" class="tooltip"> + <span>new(pos : UInt32, path : String, method : CompressionMethod = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>, flags : GeneralFlags = <span class="t">GeneralFlags</span>.flags, external : UInt32 = <span class="n">0_u32</span>)</span> + new</a> + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Class Method Detail</h2> + + <div class="entry-detail" id="new(pos:UInt32,path:String,time:Time=<spanclass="t">Time</span>.now,comment:String=<spanclass="s">&quot;&quot;</span>)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(pos : UInt32, path : String, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>) + + <a class="method-permalink" href="#new%28pos%3AUInt32%2Cpath%3AString%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29-class-method">#</a> + </div> + + <div class="doc"><p>Create a new DirEntry instance.</p> + +<p>You should not need to call this method directly; use +<code><a href="../../Zip/Writer.html#add_dir%28path%3AString%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_dir</a></code> instead.</p></div> + + <br/> + <div> + + </div> + </div> + + + + + + + +</div> + +</body> +</html> diff --git a/Zip/Writers/FileEntry.html b/Zip/Writers/FileEntry.html new file mode 100644 index 0000000..b703720 --- /dev/null +++ b/Zip/Writers/FileEntry.html @@ -0,0 +1,315 @@ +<!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::Writers::FileEntry - 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=" " 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="parent open current" data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" current" data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + + + </li> + +</ul> + + + </li> + +</ul> + +</div> + +<div id="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> Zip::Writers::FileEntry + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../Zip/Writers/FileEntry.html">Zip::Writers::FileEntry</a></li><li class="superclass"><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Internal class used to store files for <code><a href="../../Zip/Writer.html">Writer</a></code> instance.</p> + +<p>You should not need to call this method directly; it is called +automatically by <code><a href="../../Zip/Writer.html#add%28path%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add</a></code> and <code><a href="../../Zip/Writer.html#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_file</a></code>.</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> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + + + + <h2>Constant Summary</h2> + + <dl> + + <dt class="entry-const" id="FLAGS"> + <strong>FLAGS</strong> = <code><span class="t">GeneralFlags</span>.flags(<span class="t">FOOTER</span>, <span class="t">EFS</span>)</code> + </dt> + + <dd class="entry-const-doc"> + <p>Flags for local and central file header.</p> + </dd> + + + </dl> + + + + <h2>Class Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new%28pos%3AUInt32%2Cpath%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29-class-method" class="signature"><strong>.new</strong>(pos : UInt32, path : String, io : IO, method : CompressionMethod = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>)</a> + + <div class="summary"><p>Create a new FileWriterEntry instance.</p></div> + + </li> + + </ul> + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + <h3>Instance methods inherited from class <code><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></code></h3> + + + <a href="../../Zip/Writers/WriterEntry.html#to_s%28dst_io%29%3AUInt32-instance-method" class="tooltip"> + <span>to_s(dst_io) : UInt32</span> + to_s</a>, + + + <a href="../../Zip/Writers/WriterEntry.html#write_body%28dst_io%3AIO%29-instance-method" class="tooltip"> + <span>write_body(dst_io : IO)</span> + write_body</a>, + + + <a href="../../Zip/Writers/WriterEntry.html#write_central%28io%3AIO%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%29%3AUInt32-instance-method" class="tooltip"> + <span>write_central(io : IO, version : Version = <span class="t">Version</span><span class="t">::</span><span class="t">DEFAULT</span>) : UInt32</span> + write_central</a>, + + + <a href="../../Zip/Writers/WriterEntry.html#write_footer%28io%3AIO%2Ccrc%3AUInt32%2Csrc_len%3AUInt32%2Cdst_len%3AUInt32%29%3AUInt32-instance-method" class="tooltip"> + <span>write_footer(io : IO, crc : UInt32, src_len : UInt32, dst_len : UInt32) : UInt32</span> + write_footer</a> + + + + + + + <h3>Class methods inherited from class <code><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></code></h3> + + + <a href="../../Zip/Writers/WriterEntry.html#new%28pos%3AUInt32%2Cpath%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%2Cflags%3AGeneralFlags%3D%3Cspanclass%3D%22t%22%3EGeneralFlags%3C%2Fspan%3E.flags%2Cexternal%3AUInt32%3D%3Cspanclass%3D%22n%22%3E0_u32%3C%2Fspan%3E%29-class-method" class="tooltip"> + <span>new(pos : UInt32, path : String, method : CompressionMethod = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>, flags : GeneralFlags = <span class="t">GeneralFlags</span>.flags, external : UInt32 = <span class="n">0_u32</span>)</span> + new</a> + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Class Method Detail</h2> + + <div class="entry-detail" id="new(pos:UInt32,path:String,io:IO,method:CompressionMethod=<spanclass="t">CompressionMethod</span><spanclass="t">::</span><spanclass="t">DEFLATE</span>,time:Time=<spanclass="t">Time</span>.now,comment:String=<spanclass="s">&quot;&quot;</span>)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(pos : UInt32, path : String, io : IO, method : <a href="../../Zip/CompressionMethod.html">CompressionMethod</a> = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>) + + <a class="method-permalink" href="#new%28pos%3AUInt32%2Cpath%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29-class-method">#</a> + </div> + + <div class="doc"><p>Create a new FileWriterEntry instance.</p> + +<p>You should not need to call this method directly; it is called +automatically by <code><a href="../../Zip/Writer.html#add%28path%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add</a></code> and <code><a href="../../Zip/Writer.html#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_file</a></code>.</p></div> + + <br/> + <div> + + </div> + </div> + + + + + + + +</div> + +</body> +</html> diff --git a/Zip/Writers/WriterEntry.html b/Zip/Writers/WriterEntry.html new file mode 100644 index 0000000..9442e7a --- /dev/null +++ b/Zip/Writers/WriterEntry.html @@ -0,0 +1,343 @@ +<!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::Writers::WriterEntry - 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=" " 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="parent open current" data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="../../Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="../../Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="../../Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" current" data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="../../Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + + + </li> + +</ul> + + + </li> + +</ul> + +</div> + +<div id="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> Zip::Writers::WriterEntry + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../Zip/Writers/WriterEntry.html">Zip::Writers::WriterEntry</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Abstract base class for classes used to store files and directories +for <code><a href="../../Zip/Writer.html">Writer</a></code> instance.</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../../Zip/TimeHelper.html">Zip::TimeHelper</a></li> + + </ul> + + + + + + <h2>Direct Known Subclasses</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../../Zip/Writers/DirEntry.html">Zip::Writers::DirEntry</a></li> + + <li class="other-type"><a href="../../Zip/Writers/FileEntry.html">Zip::Writers::FileEntry</a></li> + + </ul> + + + + + + + <h2>Defined in:</h2> + + + + + + + <h2>Class Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new%28pos%3AUInt32%2Cpath%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%2Cflags%3AGeneralFlags%3D%3Cspanclass%3D%22t%22%3EGeneralFlags%3C%2Fspan%3E.flags%2Cexternal%3AUInt32%3D%3Cspanclass%3D%22n%22%3E0_u32%3C%2Fspan%3E%29-class-method" class="signature"><strong>.new</strong>(pos : UInt32, path : String, method : CompressionMethod = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>, flags : GeneralFlags = <span class="t">GeneralFlags</span>.flags, external : UInt32 = <span class="n">0_u32</span>)</a> + + </li> + + </ul> + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#to_s%28dst_io%29%3AUInt32-instance-method" class="signature"><strong>#to_s</strong>(dst_io) : UInt32</a> + + <div class="summary"><p>Write local file entry to IO and return the number of bytes written.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#write_body%28dst_io%3AIO%29-instance-method" class="signature"><strong>#write_body</strong>(dst_io : IO)</a> + + </li> + + <li class="entry-summary"> + <a href="#write_central%28io%3AIO%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%29%3AUInt32-instance-method" class="signature"><strong>#write_central</strong>(io : IO, version : Version = <span class="t">Version</span><span class="t">::</span><span class="t">DEFAULT</span>) : UInt32</a> + + <div class="summary"><p>Write central directory data for this <code><a href="../../Zip/Writers/WriterEntry.html">WriterEntry</a></code> and return the number of bytes written.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#write_footer%28io%3AIO%2Ccrc%3AUInt32%2Csrc_len%3AUInt32%2Cdst_len%3AUInt32%29%3AUInt32-instance-method" class="signature"><strong>#write_footer</strong>(io : IO, crc : UInt32, src_len : UInt32, dst_len : UInt32) : UInt32</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Class Method Detail</h2> + + <div class="entry-detail" id="new(pos:UInt32,path:String,method:CompressionMethod=<spanclass="t">CompressionMethod</span><spanclass="t">::</span><spanclass="t">DEFLATE</span>,time:Time=<spanclass="t">Time</span>.now,comment:String=<spanclass="s">&quot;&quot;</span>,flags:GeneralFlags=<spanclass="t">GeneralFlags</span>.flags,external:UInt32=<spanclass="n">0_u32</span>)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(pos : UInt32, path : String, method : <a href="../../Zip/CompressionMethod.html">CompressionMethod</a> = <span class="t">CompressionMethod</span><span class="t">::</span><span class="t">DEFLATE</span>, time : Time = <span class="t">Time</span>.now, comment : String = <span class="s">""</span>, flags : <a href="../../Zip/GeneralFlags.html">GeneralFlags</a> = <span class="t">GeneralFlags</span>.flags, external : UInt32 = <span class="n">0_u32</span>) + + <a class="method-permalink" href="#new%28pos%3AUInt32%2Cpath%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%2Cflags%3AGeneralFlags%3D%3Cspanclass%3D%22t%22%3EGeneralFlags%3C%2Fspan%3E.flags%2Cexternal%3AUInt32%3D%3Cspanclass%3D%22n%22%3E0_u32%3C%2Fspan%3E%29-class-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="to_s(dst_io):UInt32-instance-method"> + <div class="signature"> + + def <strong>to_s</strong>(dst_io) : UInt32 + + <a class="method-permalink" href="#to_s%28dst_io%29%3AUInt32-instance-method">#</a> + </div> + + <div class="doc"><p>Write local file entry to IO and return the number of bytes +written.</p> + +<p>You should not need to call this method directly; it is called +automatically by <code><a href="../../Zip/Writer.html#add%28path%3AString%2Cio%3AIO%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add</a></code> and <code><a href="../../Zip/Writer.html#add_file%28path%3AString%2Cfile_path%3AString%2Cmethod%3ACompressionMethod%3D%3Cspanclass%3D%22t%22%3ECompressionMethod%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFLATE%3C%2Fspan%3E%2Ctime%3ATime%3D%3Cspanclass%3D%22t%22%3ETime%3C%2Fspan%3E.now%2Ccomment%3AString%3D%3Cspanclass%3D%22s%22%3E%26quot%3B%26quot%3B%3C%2Fspan%3E%29%3AUInt32-instance-method">Writer#add_file</a></code>.</p></div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="write_body(dst_io:IO)-instance-method"> + <div class="signature"> + abstract + def <strong>write_body</strong>(dst_io : IO) + + <a class="method-permalink" href="#write_body%28dst_io%3AIO%29-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="write_central(io:IO,version:Version=<spanclass="t">Version</span><spanclass="t">::</span><spanclass="t">DEFAULT</span>):UInt32-instance-method"> + <div class="signature"> + + def <strong>write_central</strong>(io : IO, version : <a href="../../Zip/Version.html">Version</a> = <span class="t">Version</span><span class="t">::</span><span class="t">DEFAULT</span>) : UInt32 + + <a class="method-permalink" href="#write_central%28io%3AIO%2Cversion%3AVersion%3D%3Cspanclass%3D%22t%22%3EVersion%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3E%3A%3A%3C%2Fspan%3E%3Cspanclass%3D%22t%22%3EDEFAULT%3C%2Fspan%3E%29%3AUInt32-instance-method">#</a> + </div> + + <div class="doc"><p>Write central directory data for this <code><a href="../../Zip/Writers/WriterEntry.html">WriterEntry</a></code> and return the +number of bytes written.</p> + +<p>You never need to call this method directly; it is called +automatically by <code><a href="../../Zip/Writer.html#close-instance-method">Writer#close</a></code>.</p></div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="write_footer(io:IO,crc:UInt32,src_len:UInt32,dst_len:UInt32):UInt32-instance-method"> + <div class="signature"> + abstract + def <strong>write_footer</strong>(io : IO, crc : UInt32, src_len : UInt32, dst_len : UInt32) : UInt32 + + <a class="method-permalink" href="#write_footer%28io%3AIO%2Ccrc%3AUInt32%2Csrc_len%3AUInt32%2Cdst_len%3AUInt32%29%3AUInt32-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + + + + +</div> + +</body> +</html> @@ -85,8 +85,28 @@ </li> - <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/WriterEntry" data-name="zip::writerentry"> - <a href="Zip/WriterEntry.html">WriterEntry</a> + <li class="parent " data-id="github.com/pablotron/zip-crystal/Zip/Writers" data-name="zip::writers"> + <a href="Zip/Writers.html">Writers</a> + + <ul> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/DirEntry" data-name="zip::writers::direntry"> + <a href="Zip/Writers/DirEntry.html">DirEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/FileEntry" data-name="zip::writers::fileentry"> + <a href="Zip/Writers/FileEntry.html">FileEntry</a> + + </li> + + <li class=" " data-id="github.com/pablotron/zip-crystal/Zip/Writers/WriterEntry" data-name="zip::writers::writerentry"> + <a href="Zip/Writers/WriterEntry.html">WriterEntry</a> + + </li> + +</ul> + </li> @@ -129,16 +149,13 @@ <span class="c"># create memory io</span> mem_io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span> -<span class="c"># open "/some/other/path/image.png" for writing</span> -<span class="t">File</span>.open(<span class="s">"/some/other/path/image.png"</span>, <span class="s">"wb"</span>) <span class="k">do</span> <span class="o">|</span>file_io<span class="o">|</span> - <span class="c"># read from "foo.zip"</span> - <span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> - <span class="c"># extract "bar.txt" to mem_io</span> - zip[<span class="s">"bar.txt"</span>].read(mem_io) +<span class="c"># read from "foo.zip"</span> +<span class="t">Zip</span>.read(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># extract "bar.txt" to mem_io</span> + zip[<span class="s">"bar.txt"</span>].write(mem_io) - <span class="c"># extract "image.png" to file_io</span> - zip[<span class="s">"image.png"</span>].read(file_io) - <span class="k">end</span> + <span class="c"># extract "image.png" to "output-image.png"</span> + zip[<span class="s">"image.png"</span>].write(<span class="s">"output-image.png"</span>) <span class="k">end</span></code></pre> <p>See the <a href="https://pablotron.github.com/zip-crystal/" target="_blank">API documentation</a> |