123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!-- NewPage -->
- <html lang="de">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>TarUtils (Apache Commons Compress 1.13 API)</title>
- <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
- </head>
- <body>
- <script type="text/javascript"><!--
- try {
- if (location.href.indexOf('is-external=true') == -1) {
- parent.document.title="TarUtils (Apache Commons Compress 1.13 API)";
- }
- }
- catch(err) {
- }
- //-->
- </script>
- <noscript>
- <div>JavaScript is disabled on your browser.</div>
- </noscript>
- <!-- ========= START OF TOP NAVBAR ======= -->
- <div class="topNav"><a name="navbar_top">
- <!-- -->
- </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
- <!-- -->
- </a>
- <ul class="navList" title="Navigation">
- <li><a href="../../../../../../overview-summary.html">Overview</a></li>
- <li><a href="package-summary.html">Package</a></li>
- <li class="navBarCell1Rev">Class</li>
- <li><a href="class-use/TarUtils.html">Use</a></li>
- <li><a href="package-tree.html">Tree</a></li>
- <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
- <li><a href="../../../../../../index-all.html">Index</a></li>
- <li><a href="../../../../../../help-doc.html">Help</a></li>
- </ul>
- </div>
- <div class="subNav">
- <ul class="navList">
- <li><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarConstants.html" title="interface in org.apache.commons.compress.archivers.tar"><span class="strong">Prev Class</span></a></li>
- <li>Next Class</li>
- </ul>
- <ul class="navList">
- <li><a href="../../../../../../index.html?org/apache/commons/compress/archivers/tar/TarUtils.html" target="_top">Frames</a></li>
- <li><a href="TarUtils.html" target="_top">No Frames</a></li>
- </ul>
- <ul class="navList" id="allclasses_navbar_top">
- <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
- </ul>
- <div>
- <script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_top");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
- </script>
- </div>
- <div>
- <ul class="subNavList">
- <li>Summary: </li>
- <li>Nested | </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method_summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method_detail">Method</a></li>
- </ul>
- </div>
- <a name="skip-navbar_top">
- <!-- -->
- </a></div>
- <!-- ========= END OF TOP NAVBAR ========= -->
- <!-- ======== START OF CLASS DATA ======== -->
- <div class="header">
- <div class="subTitle">org.apache.commons.compress.archivers.tar</div>
- <h2 title="Class TarUtils" class="title">Class TarUtils</h2>
- </div>
- <div class="contentContainer">
- <ul class="inheritance">
- <li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
- <li>
- <ul class="inheritance">
- <li>org.apache.commons.compress.archivers.tar.TarUtils</li>
- </ul>
- </li>
- </ul>
- <div class="description">
- <ul class="blockList">
- <li class="blockList">
- <hr>
- <br>
- <pre>public class <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.36">TarUtils</a>
- extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
- <div class="block">This class provides static utility methods to work with byte streams.</div>
- <dl><dt><span class="strong">This class is immutable</span></dt>
- <dd></dd></dl>
- </li>
- </ul>
- </div>
- <div class="summary">
- <ul class="blockList">
- <li class="blockList">
- <!-- ========== METHOD SUMMARY =========== -->
- <ul class="blockList">
- <li class="blockList"><a name="method_summary">
- <!-- -->
- </a>
- <h3>Method Summary</h3>
- <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
- <caption><span>Methods</span><span class="tabEnd"> </span></caption>
- <tr>
- <th class="colFirst" scope="col">Modifier and Type</th>
- <th class="colLast" scope="col">Method and Description</th>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static long</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#computeCheckSum(byte[])">computeCheckSum</a></strong>(byte[] buf)</code>
- <div class="block">Compute the checksum of a tar entry header.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatCheckSumOctalBytes(long,%20byte[],%20int,%20int)">formatCheckSumOctalBytes</a></strong>(long value,
- byte[] buf,
- int offset,
- int length)</code>
- <div class="block">Writes an octal value into a buffer.</div>
- </td>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatLongOctalBytes(long,%20byte[],%20int,%20int)">formatLongOctalBytes</a></strong>(long value,
- byte[] buf,
- int offset,
- int length)</code>
- <div class="block">Write an octal long integer into a buffer.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatLongOctalOrBinaryBytes(long,%20byte[],%20int,%20int)">formatLongOctalOrBinaryBytes</a></strong>(long value,
- byte[] buf,
- int offset,
- int length)</code>
- <div class="block">Write an long integer into a buffer as an octal string if this
- will fit, or as a binary number otherwise.</div>
- </td>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatNameBytes(java.lang.String,%20byte[],%20int,%20int)">formatNameBytes</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name,
- byte[] buf,
- int offset,
- int length)</code>
- <div class="block">Copy a name into a buffer.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatNameBytes(java.lang.String,%20byte[],%20int,%20int,%20org.apache.commons.compress.archivers.zip.ZipEncoding)">formatNameBytes</a></strong>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name,
- byte[] buf,
- int offset,
- int length,
- <a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html" title="interface in org.apache.commons.compress.archivers.zip">ZipEncoding</a> encoding)</code>
- <div class="block">Copy a name into a buffer.</div>
- </td>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static int</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatOctalBytes(long,%20byte[],%20int,%20int)">formatOctalBytes</a></strong>(long value,
- byte[] buf,
- int offset,
- int length)</code>
- <div class="block">Write an octal integer into a buffer.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static void</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatUnsignedOctalString(long,%20byte[],%20int,%20int)">formatUnsignedOctalString</a></strong>(long value,
- byte[] buffer,
- int offset,
- int length)</code>
- <div class="block">Fill buffer with unsigned octal number, padded with leading zeroes.</div>
- </td>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#parseBoolean(byte[],%20int)">parseBoolean</a></strong>(byte[] buffer,
- int offset)</code>
- <div class="block">Parse a boolean byte from a buffer.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#parseName(byte[],%20int,%20int)">parseName</a></strong>(byte[] buffer,
- int offset,
- int length)</code>
- <div class="block">Parse an entry name from a buffer.</div>
- </td>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#parseName(byte[],%20int,%20int,%20org.apache.commons.compress.archivers.zip.ZipEncoding)">parseName</a></strong>(byte[] buffer,
- int offset,
- int length,
- <a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html" title="interface in org.apache.commons.compress.archivers.zip">ZipEncoding</a> encoding)</code>
- <div class="block">Parse an entry name from a buffer.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static long</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#parseOctal(byte[],%20int,%20int)">parseOctal</a></strong>(byte[] buffer,
- int offset,
- int length)</code>
- <div class="block">Parse an octal string from a buffer.</div>
- </td>
- </tr>
- <tr class="altColor">
- <td class="colFirst"><code>static long</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#parseOctalOrBinary(byte[],%20int,%20int)">parseOctalOrBinary</a></strong>(byte[] buffer,
- int offset,
- int length)</code>
- <div class="block">Compute the value contained in a byte buffer.</div>
- </td>
- </tr>
- <tr class="rowColor">
- <td class="colFirst"><code>static boolean</code></td>
- <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#verifyCheckSum(byte[])">verifyCheckSum</a></strong>(byte[] header)</code>
- <div class="block">Wikipedia <a href="http://en.wikipedia.org/wiki/Tar_(file_format)#File_header">says</a>:
-
- The checksum is calculated by taking the sum of the unsigned byte values
- of the header block with the eight checksum bytes taken to be ascii
- spaces (decimal value 32).</div>
- </td>
- </tr>
- </table>
- <ul class="blockList">
- <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
- <!-- -->
- </a>
- <h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
- <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)" title="class or interface in java.lang">wait</a></code></li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- <div class="details">
- <ul class="blockList">
- <li class="blockList">
- <!-- ============ METHOD DETAIL ========== -->
- <ul class="blockList">
- <li class="blockList"><a name="method_detail">
- <!-- -->
- </a>
- <h3>Method Detail</h3>
- <a name="parseOctal(byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>parseOctal</h4>
- <pre>public static long <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.104">parseOctal</a>(byte[] buffer,
- int offset,
- int length)</pre>
- <div class="block">Parse an octal string from a buffer.
- <p>Leading spaces are ignored.
- The buffer must contain a trailing space or NUL,
- and may contain an additional trailing space or NUL.</p>
- <p>The input buffer is allowed to contain all NULs,
- in which case the method returns 0L
- (this allows for missing fields).</p>
- <p>To work-around some tar implementations that insert a
- leading NUL this method returns 0 if it detects a leading NUL
- since Commons Compress 1.4.</p></div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer from which to parse.</dd><dd><code>offset</code> - The offset into the buffer from which to parse.</dd><dd><code>length</code> - The maximum number of bytes to parse - must be at least 2 bytes.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The long value of the octal string.</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the trailing space/NUL is missing or if a invalid byte is detected.</dd></dl>
- </li>
- </ul>
- <a name="parseOctalOrBinary(byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>parseOctalOrBinary</h4>
- <pre>public static long <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.167">parseOctalOrBinary</a>(byte[] buffer,
- int offset,
- int length)</pre>
- <div class="block">Compute the value contained in a byte buffer. If the most
- significant bit of the first byte in the buffer is set, this
- bit is ignored and the rest of the buffer is interpreted as a
- binary number. Otherwise, the buffer is interpreted as an
- octal number as per the parseOctal function above.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer from which to parse.</dd><dd><code>offset</code> - The offset into the buffer from which to parse.</dd><dd><code>length</code> - The maximum number of bytes to parse.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The long value of the octal or binary string.</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the trailing space/NUL is
- missing or an invalid byte is detected in an octal number, or
- if a binary number would exceed the size of a signed long
- 64-bit integer.</dd><dt><span class="strong">Since:</span></dt>
- <dd>1.4</dd></dl>
- </li>
- </ul>
- <a name="parseBoolean(byte[], int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>parseBoolean</h4>
- <pre>public static boolean <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.231">parseBoolean</a>(byte[] buffer,
- int offset)</pre>
- <div class="block">Parse a boolean byte from a buffer.
- Leading spaces and NUL are ignored.
- The buffer may contain trailing spaces or NULs.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer from which to parse.</dd><dd><code>offset</code> - The offset into the buffer from which to parse.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The boolean value of the bytes.</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if an invalid byte is detected.</dd></dl>
- </li>
- </ul>
- <a name="parseName(byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>parseName</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.262">parseName</a>(byte[] buffer,
- int offset,
- int length)</pre>
- <div class="block">Parse an entry name from a buffer.
- Parsing stops when a NUL is found
- or the buffer length is reached.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer from which to parse.</dd><dd><code>offset</code> - The offset into the buffer from which to parse.</dd><dd><code>length</code> - The maximum number of bytes to parse.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The entry name.</dd></dl>
- </li>
- </ul>
- <a name="parseName(byte[], int, int, org.apache.commons.compress.archivers.zip.ZipEncoding)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>parseName</h4>
- <pre>public static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.288">parseName</a>(byte[] buffer,
- int offset,
- int length,
- <a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html" title="interface in org.apache.commons.compress.archivers.zip">ZipEncoding</a> encoding)
- throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
- <div class="block">Parse an entry name from a buffer.
- Parsing stops when a NUL is found
- or the buffer length is reached.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buffer</code> - The buffer from which to parse.</dd><dd><code>offset</code> - The offset into the buffer from which to parse.</dd><dd><code>length</code> - The maximum number of bytes to parse.</dd><dd><code>encoding</code> - name of the encoding to use for file names</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The entry name.</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - on error</dd><dt><span class="strong">Since:</span></dt>
- <dd>1.4</dd></dl>
- </li>
- </ul>
- <a name="formatNameBytes(java.lang.String, byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatNameBytes</h4>
- <pre>public static int <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.322">formatNameBytes</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name,
- byte[] buf,
- int offset,
- int length)</pre>
- <div class="block">Copy a name into a buffer.
- Copies characters from the name into the buffer
- starting at the specified offset.
- If the buffer is longer than the name, the buffer
- is filled with trailing NULs.
- If the name is longer than the buffer,
- the output is truncated.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - The header name from which to copy the characters.</dd><dd><code>buf</code> - The buffer where the name is to be stored.</dd><dd><code>offset</code> - The starting offset into the buffer</dd><dd><code>length</code> - The maximum number of header bytes to copy.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The updated offset, i.e. offset + length</dd></dl>
- </li>
- </ul>
- <a name="formatNameBytes(java.lang.String, byte[], int, int, org.apache.commons.compress.archivers.zip.ZipEncoding)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatNameBytes</h4>
- <pre>public static int <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.354">formatNameBytes</a>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name,
- byte[] buf,
- int offset,
- int length,
- <a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html" title="interface in org.apache.commons.compress.archivers.zip">ZipEncoding</a> encoding)
- throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
- <div class="block">Copy a name into a buffer.
- Copies characters from the name into the buffer
- starting at the specified offset.
- If the buffer is longer than the name, the buffer
- is filled with trailing NULs.
- If the name is longer than the buffer,
- the output is truncated.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - The header name from which to copy the characters.</dd><dd><code>buf</code> - The buffer where the name is to be stored.</dd><dd><code>offset</code> - The starting offset into the buffer</dd><dd><code>length</code> - The maximum number of header bytes to copy.</dd><dd><code>encoding</code> - name of the encoding to use for file names</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The updated offset, i.e. offset + length</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - on error</dd><dt><span class="strong">Since:</span></dt>
- <dd>1.4</dd></dl>
- </li>
- </ul>
- <a name="formatUnsignedOctalString(long, byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatUnsignedOctalString</h4>
- <pre>public static void <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.383">formatUnsignedOctalString</a>(long value,
- byte[] buffer,
- int offset,
- int length)</pre>
- <div class="block">Fill buffer with unsigned octal number, padded with leading zeroes.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - number to convert to octal - treated as unsigned</dd><dd><code>buffer</code> - destination buffer</dd><dd><code>offset</code> - starting offset in buffer</dd><dd><code>length</code> - length of buffer to fill</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the value will not fit in the buffer</dd></dl>
- </li>
- </ul>
- <a name="formatOctalBytes(long, byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatOctalBytes</h4>
- <pre>public static int <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.422">formatOctalBytes</a>(long value,
- byte[] buf,
- int offset,
- int length)</pre>
- <div class="block">Write an octal integer into a buffer.
- Uses <a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatUnsignedOctalString(long,%20byte[],%20int,%20int)"><code>formatUnsignedOctalString(long, byte[], int, int)</code></a> to format
- the value as an octal string with leading zeros.
- The converted number is followed by space and NUL</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - The value to write</dd><dd><code>buf</code> - The buffer to receive the output</dd><dd><code>offset</code> - The starting offset into the buffer</dd><dd><code>length</code> - The size of the output buffer</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The updated offset, i.e offset+length</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the value (and trailer) will not fit in the buffer</dd></dl>
- </li>
- </ul>
- <a name="formatLongOctalBytes(long, byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatLongOctalBytes</h4>
- <pre>public static int <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.447">formatLongOctalBytes</a>(long value,
- byte[] buf,
- int offset,
- int length)</pre>
- <div class="block">Write an octal long integer into a buffer.
-
- Uses <a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatUnsignedOctalString(long,%20byte[],%20int,%20int)"><code>formatUnsignedOctalString(long, byte[], int, int)</code></a> to format
- the value as an octal string with leading zeros.
- The converted number is followed by a space.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - The value to write as octal</dd><dd><code>buf</code> - The destinationbuffer.</dd><dd><code>offset</code> - The starting offset into the buffer.</dd><dd><code>length</code> - The length of the buffer</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The updated offset</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the value (and trailer) will not fit in the buffer</dd></dl>
- </li>
- </ul>
- <a name="formatLongOctalOrBinaryBytes(long, byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatLongOctalOrBinaryBytes</h4>
- <pre>public static int <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.474">formatLongOctalOrBinaryBytes</a>(long value,
- byte[] buf,
- int offset,
- int length)</pre>
- <div class="block">Write an long integer into a buffer as an octal string if this
- will fit, or as a binary number otherwise.
-
- Uses <a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatUnsignedOctalString(long,%20byte[],%20int,%20int)"><code>formatUnsignedOctalString(long, byte[], int, int)</code></a> to format
- the value as an octal string with leading zeros.
- The converted number is followed by a space.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - The value to write into the buffer.</dd><dd><code>buf</code> - The destination buffer.</dd><dd><code>offset</code> - The starting offset into the buffer.</dd><dd><code>length</code> - The length of the buffer.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The updated offset.</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the value (and trailer)
- will not fit in the buffer.</dd><dt><span class="strong">Since:</span></dt>
- <dd>1.4</dd></dl>
- </li>
- </ul>
- <a name="formatCheckSumOctalBytes(long, byte[], int, int)">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>formatCheckSumOctalBytes</h4>
- <pre>public static int <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.544">formatCheckSumOctalBytes</a>(long value,
- byte[] buf,
- int offset,
- int length)</pre>
- <div class="block">Writes an octal value into a buffer.
-
- Uses <a href="../../../../../../org/apache/commons/compress/archivers/tar/TarUtils.html#formatUnsignedOctalString(long,%20byte[],%20int,%20int)"><code>formatUnsignedOctalString(long, byte[], int, int)</code></a> to format
- the value as an octal string with leading zeros.
- The converted number is followed by NUL and then space.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>value</code> - The value to convert</dd><dd><code>buf</code> - The destination buffer</dd><dd><code>offset</code> - The starting offset into the buffer.</dd><dd><code>length</code> - The size of the buffer.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The updated value of offset, i.e. offset+length</dd>
- <dt><span class="strong">Throws:</span></dt>
- <dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if the value (and trailer) will not fit in the buffer</dd></dl>
- </li>
- </ul>
- <a name="computeCheckSum(byte[])">
- <!-- -->
- </a>
- <ul class="blockList">
- <li class="blockList">
- <h4>computeCheckSum</h4>
- <pre>public static long <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.561">computeCheckSum</a>(byte[] buf)</pre>
- <div class="block">Compute the checksum of a tar entry header.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>buf</code> - The tar entry's header buffer.</dd>
- <dt><span class="strong">Returns:</span></dt><dd>The computed checksum.</dd></dl>
- </li>
- </ul>
- <a name="verifyCheckSum(byte[])">
- <!-- -->
- </a>
- <ul class="blockListLast">
- <li class="blockList">
- <h4>verifyCheckSum</h4>
- <pre>public static boolean <a href="../../../../../../src-html/org/apache/commons/compress/archivers/tar/TarUtils.html#line.596">verifyCheckSum</a>(byte[] header)</pre>
- <div class="block">Wikipedia <a href="http://en.wikipedia.org/wiki/Tar_(file_format)#File_header">says</a>:
- <blockquote>
- The checksum is calculated by taking the sum of the unsigned byte values
- of the header block with the eight checksum bytes taken to be ascii
- spaces (decimal value 32). It is stored as a six digit octal number with
- leading zeroes followed by a NUL and then a space. Various
- implementations do not adhere to this format. For better compatibility,
- ignore leading and trailing whitespace, and get the first six digits. In
- addition, some historic tar implementations treated bytes as signed.
- Implementations typically calculate the checksum both ways, and treat it
- as good if either the signed or unsigned sum matches the included
- checksum.
- </blockquote>
- <p>
- The return value of this method should be treated as a best-effort
- heuristic rather than an absolute and final truth. The checksum
- verification logic may well evolve over time as more special cases
- are encountered.</div>
- <dl><dt><span class="strong">Parameters:</span></dt><dd><code>header</code> - tar header</dd>
- <dt><span class="strong">Returns:</span></dt><dd>whether the checksum is reasonably good</dd><dt><span class="strong">Since:</span></dt>
- <dd>1.5</dd>
- <dt><span class="strong">See Also:</span></dt><dd><a href="https://issues.apache.org/jira/browse/COMPRESS-191">COMPRESS-191</a></dd></dl>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- </div>
- <!-- ========= END OF CLASS DATA ========= -->
- <!-- ======= START OF BOTTOM NAVBAR ====== -->
- <div class="bottomNav"><a name="navbar_bottom">
- <!-- -->
- </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
- <!-- -->
- </a>
- <ul class="navList" title="Navigation">
- <li><a href="../../../../../../overview-summary.html">Overview</a></li>
- <li><a href="package-summary.html">Package</a></li>
- <li class="navBarCell1Rev">Class</li>
- <li><a href="class-use/TarUtils.html">Use</a></li>
- <li><a href="package-tree.html">Tree</a></li>
- <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
- <li><a href="../../../../../../index-all.html">Index</a></li>
- <li><a href="../../../../../../help-doc.html">Help</a></li>
- </ul>
- </div>
- <div class="subNav">
- <ul class="navList">
- <li><a href="../../../../../../org/apache/commons/compress/archivers/tar/TarConstants.html" title="interface in org.apache.commons.compress.archivers.tar"><span class="strong">Prev Class</span></a></li>
- <li>Next Class</li>
- </ul>
- <ul class="navList">
- <li><a href="../../../../../../index.html?org/apache/commons/compress/archivers/tar/TarUtils.html" target="_top">Frames</a></li>
- <li><a href="TarUtils.html" target="_top">No Frames</a></li>
- </ul>
- <ul class="navList" id="allclasses_navbar_bottom">
- <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
- </ul>
- <div>
- <script type="text/javascript"><!--
- allClassesLink = document.getElementById("allclasses_navbar_bottom");
- if(window==top) {
- allClassesLink.style.display = "block";
- }
- else {
- allClassesLink.style.display = "none";
- }
- //-->
- </script>
- </div>
- <div>
- <ul class="subNavList">
- <li>Summary: </li>
- <li>Nested | </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method_summary">Method</a></li>
- </ul>
- <ul class="subNavList">
- <li>Detail: </li>
- <li>Field | </li>
- <li>Constr | </li>
- <li><a href="#method_detail">Method</a></li>
- </ul>
- </div>
- <a name="skip-navbar_bottom">
- <!-- -->
- </a></div>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- <p class="legalCopy"><small>Copyright © 2016 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
- </body>
- </html>
|