ZipEncoding.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="de">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <title>ZipEncoding (Apache Commons Compress 1.13 API)</title>
  7. <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
  8. </head>
  9. <body>
  10. <script type="text/javascript"><!--
  11. try {
  12. if (location.href.indexOf('is-external=true') == -1) {
  13. parent.document.title="ZipEncoding (Apache Commons Compress 1.13 API)";
  14. }
  15. }
  16. catch(err) {
  17. }
  18. //-->
  19. </script>
  20. <noscript>
  21. <div>JavaScript is disabled on your browser.</div>
  22. </noscript>
  23. <!-- ========= START OF TOP NAVBAR ======= -->
  24. <div class="topNav"><a name="navbar_top">
  25. <!-- -->
  26. </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
  27. <!-- -->
  28. </a>
  29. <ul class="navList" title="Navigation">
  30. <li><a href="../../../../../../overview-summary.html">Overview</a></li>
  31. <li><a href="package-summary.html">Package</a></li>
  32. <li class="navBarCell1Rev">Class</li>
  33. <li><a href="class-use/ZipEncoding.html">Use</a></li>
  34. <li><a href="package-tree.html">Tree</a></li>
  35. <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
  36. <li><a href="../../../../../../index-all.html">Index</a></li>
  37. <li><a href="../../../../../../help-doc.html">Help</a></li>
  38. </ul>
  39. </div>
  40. <div class="subNav">
  41. <ul class="navList">
  42. <li><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEightByteInteger.html" title="class in org.apache.commons.compress.archivers.zip"><span class="strong">Prev Class</span></a></li>
  43. <li><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncodingHelper.html" title="class in org.apache.commons.compress.archivers.zip"><span class="strong">Next Class</span></a></li>
  44. </ul>
  45. <ul class="navList">
  46. <li><a href="../../../../../../index.html?org/apache/commons/compress/archivers/zip/ZipEncoding.html" target="_top">Frames</a></li>
  47. <li><a href="ZipEncoding.html" target="_top">No Frames</a></li>
  48. </ul>
  49. <ul class="navList" id="allclasses_navbar_top">
  50. <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
  51. </ul>
  52. <div>
  53. <script type="text/javascript"><!--
  54. allClassesLink = document.getElementById("allclasses_navbar_top");
  55. if(window==top) {
  56. allClassesLink.style.display = "block";
  57. }
  58. else {
  59. allClassesLink.style.display = "none";
  60. }
  61. //-->
  62. </script>
  63. </div>
  64. <div>
  65. <ul class="subNavList">
  66. <li>Summary:&nbsp;</li>
  67. <li>Nested&nbsp;|&nbsp;</li>
  68. <li>Field&nbsp;|&nbsp;</li>
  69. <li>Constr&nbsp;|&nbsp;</li>
  70. <li><a href="#method_summary">Method</a></li>
  71. </ul>
  72. <ul class="subNavList">
  73. <li>Detail:&nbsp;</li>
  74. <li>Field&nbsp;|&nbsp;</li>
  75. <li>Constr&nbsp;|&nbsp;</li>
  76. <li><a href="#method_detail">Method</a></li>
  77. </ul>
  78. </div>
  79. <a name="skip-navbar_top">
  80. <!-- -->
  81. </a></div>
  82. <!-- ========= END OF TOP NAVBAR ========= -->
  83. <!-- ======== START OF CLASS DATA ======== -->
  84. <div class="header">
  85. <div class="subTitle">org.apache.commons.compress.archivers.zip</div>
  86. <h2 title="Interface ZipEncoding" class="title">Interface ZipEncoding</h2>
  87. </div>
  88. <div class="contentContainer">
  89. <div class="description">
  90. <ul class="blockList">
  91. <li class="blockList">
  92. <hr>
  93. <br>
  94. <pre>public interface <a href="../../../../../../src-html/org/apache/commons/compress/archivers/zip/ZipEncoding.html#line.44">ZipEncoding</a></pre>
  95. <div class="block">An interface for encoders that do a pretty encoding of ZIP
  96. filenames.
  97. <p>There are mostly two implementations, one that uses java.nio
  98. <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html?is-external=true" title="class or interface in java.nio.charset"><code>Charset</code></a> and one implementation,
  99. which copes with simple 8 bit charsets, because java-1.4 did not
  100. support Cp437 in java.nio.</p>
  101. <p>The main reason for defining an own encoding layer comes from
  102. the problems with <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true#getBytes(java.lang.String)" title="class or interface in java.lang"><code>String.getBytes</code></a>, which encodes unknown characters as ASCII
  103. quotation marks ('?'). Quotation marks are per definition an
  104. invalid filename on some operating systems like Windows, which
  105. leads to ignored ZIP entries.</p>
  106. <p>All implementations should implement this interface in a
  107. reentrant way.</p></div>
  108. </li>
  109. </ul>
  110. </div>
  111. <div class="summary">
  112. <ul class="blockList">
  113. <li class="blockList">
  114. <!-- ========== METHOD SUMMARY =========== -->
  115. <ul class="blockList">
  116. <li class="blockList"><a name="method_summary">
  117. <!-- -->
  118. </a>
  119. <h3>Method Summary</h3>
  120. <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  121. <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
  122. <tr>
  123. <th class="colFirst" scope="col">Modifier and Type</th>
  124. <th class="colLast" scope="col">Method and Description</th>
  125. </tr>
  126. <tr class="altColor">
  127. <td class="colFirst"><code>boolean</code></td>
  128. <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html#canEncode(java.lang.String)">canEncode</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>&nbsp;name)</code>
  129. <div class="block">Check, whether the given string may be losslessly encoded using this
  130. encoding.</div>
  131. </td>
  132. </tr>
  133. <tr class="rowColor">
  134. <td class="colFirst"><code><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>
  135. <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html#decode(byte[])">decode</a></strong>(byte[]&nbsp;data)</code>&nbsp;</td>
  136. </tr>
  137. <tr class="altColor">
  138. <td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a></code></td>
  139. <td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncoding.html#encode(java.lang.String)">encode</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>&nbsp;name)</code>
  140. <div class="block">Encode a filename or a comment to a byte array suitable for
  141. storing it to a serialized zip entry.</div>
  142. </td>
  143. </tr>
  144. </table>
  145. </li>
  146. </ul>
  147. </li>
  148. </ul>
  149. </div>
  150. <div class="details">
  151. <ul class="blockList">
  152. <li class="blockList">
  153. <!-- ============ METHOD DETAIL ========== -->
  154. <ul class="blockList">
  155. <li class="blockList"><a name="method_detail">
  156. <!-- -->
  157. </a>
  158. <h3>Method Detail</h3>
  159. <a name="canEncode(java.lang.String)">
  160. <!-- -->
  161. </a>
  162. <ul class="blockList">
  163. <li class="blockList">
  164. <h4>canEncode</h4>
  165. <pre>boolean&nbsp;<a href="../../../../../../src-html/org/apache/commons/compress/archivers/zip/ZipEncoding.html#line.52">canEncode</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>&nbsp;name)</pre>
  166. <div class="block">Check, whether the given string may be losslessly encoded using this
  167. encoding.</div>
  168. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - A filename or ZIP comment.</dd>
  169. <dt><span class="strong">Returns:</span></dt><dd>Whether the given name may be encoded with out any losses.</dd></dl>
  170. </li>
  171. </ul>
  172. <a name="encode(java.lang.String)">
  173. <!-- -->
  174. </a>
  175. <ul class="blockList">
  176. <li class="blockList">
  177. <h4>encode</h4>
  178. <pre><a href="http://docs.oracle.com/javase/7/docs/api/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio">ByteBuffer</a>&nbsp;<a href="../../../../../../src-html/org/apache/commons/compress/archivers/zip/ZipEncoding.html#line.76">encode</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>&nbsp;name)
  179. 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>
  180. <div class="block">Encode a filename or a comment to a byte array suitable for
  181. storing it to a serialized zip entry.
  182. <p>Examples for CP 437 (in pseudo-notation, right hand side is
  183. C-style notation):</p>
  184. <pre>
  185. encode("?_for_Dollar.txt") = "%U20AC_for_Dollar.txt"
  186. encode("Ölfässer.txt") = "\231lf\204sser.txt"
  187. </pre></div>
  188. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>name</code> - A filename or ZIP comment.</dd>
  189. <dt><span class="strong">Returns:</span></dt><dd>A byte buffer with a backing array containing the
  190. encoded name. Unmappable characters or malformed
  191. character sequences are mapped to a sequence of utf-16
  192. words encoded in the format <code>%Uxxxx</code>. It is
  193. assumed, that the byte buffer is positioned at the
  194. beginning of the encoded result, the byte buffer has a
  195. backing array and the limit of the byte buffer points
  196. to the end of the encoded result.</dd>
  197. <dt><span class="strong">Throws:</span></dt>
  198. <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></dl>
  199. </li>
  200. </ul>
  201. <a name="decode(byte[])">
  202. <!-- -->
  203. </a>
  204. <ul class="blockListLast">
  205. <li class="blockList">
  206. <h4>decode</h4>
  207. <pre><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>&nbsp;<a href="../../../../../../src-html/org/apache/commons/compress/archivers/zip/ZipEncoding.html#line.83">decode</a>(byte[]&nbsp;data)
  208. 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>
  209. <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - The byte values to decode.</dd>
  210. <dt><span class="strong">Returns:</span></dt><dd>The decoded string.</dd>
  211. <dt><span class="strong">Throws:</span></dt>
  212. <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></dl>
  213. </li>
  214. </ul>
  215. </li>
  216. </ul>
  217. </li>
  218. </ul>
  219. </div>
  220. </div>
  221. <!-- ========= END OF CLASS DATA ========= -->
  222. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  223. <div class="bottomNav"><a name="navbar_bottom">
  224. <!-- -->
  225. </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
  226. <!-- -->
  227. </a>
  228. <ul class="navList" title="Navigation">
  229. <li><a href="../../../../../../overview-summary.html">Overview</a></li>
  230. <li><a href="package-summary.html">Package</a></li>
  231. <li class="navBarCell1Rev">Class</li>
  232. <li><a href="class-use/ZipEncoding.html">Use</a></li>
  233. <li><a href="package-tree.html">Tree</a></li>
  234. <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
  235. <li><a href="../../../../../../index-all.html">Index</a></li>
  236. <li><a href="../../../../../../help-doc.html">Help</a></li>
  237. </ul>
  238. </div>
  239. <div class="subNav">
  240. <ul class="navList">
  241. <li><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEightByteInteger.html" title="class in org.apache.commons.compress.archivers.zip"><span class="strong">Prev Class</span></a></li>
  242. <li><a href="../../../../../../org/apache/commons/compress/archivers/zip/ZipEncodingHelper.html" title="class in org.apache.commons.compress.archivers.zip"><span class="strong">Next Class</span></a></li>
  243. </ul>
  244. <ul class="navList">
  245. <li><a href="../../../../../../index.html?org/apache/commons/compress/archivers/zip/ZipEncoding.html" target="_top">Frames</a></li>
  246. <li><a href="ZipEncoding.html" target="_top">No Frames</a></li>
  247. </ul>
  248. <ul class="navList" id="allclasses_navbar_bottom">
  249. <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
  250. </ul>
  251. <div>
  252. <script type="text/javascript"><!--
  253. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  254. if(window==top) {
  255. allClassesLink.style.display = "block";
  256. }
  257. else {
  258. allClassesLink.style.display = "none";
  259. }
  260. //-->
  261. </script>
  262. </div>
  263. <div>
  264. <ul class="subNavList">
  265. <li>Summary:&nbsp;</li>
  266. <li>Nested&nbsp;|&nbsp;</li>
  267. <li>Field&nbsp;|&nbsp;</li>
  268. <li>Constr&nbsp;|&nbsp;</li>
  269. <li><a href="#method_summary">Method</a></li>
  270. </ul>
  271. <ul class="subNavList">
  272. <li>Detail:&nbsp;</li>
  273. <li>Field&nbsp;|&nbsp;</li>
  274. <li>Constr&nbsp;|&nbsp;</li>
  275. <li><a href="#method_detail">Method</a></li>
  276. </ul>
  277. </div>
  278. <a name="skip-navbar_bottom">
  279. <!-- -->
  280. </a></div>
  281. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  282. <p class="legalCopy"><small>Copyright &#169; 2016 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
  283. </body>
  284. </html>