Package net.i2p.util

Class ZipFileComment


  • @Deprecated
    public abstract class ZipFileComment
    extends Object
    Deprecated.
    scheduled for removal late 2017, not for external use
    Not available in ZipFile until Java 7. Refs: https://secure.wikimedia.org/wikipedia/en/wiki/ZIP_%28file_format%29 http://download.oracle.com/javase/1.5.0/docs/api/java/util/zip/ZipFile.html http://bugs.sun.com/view_bug.do?bug_id=6646605 Code modified from: http://www.flattermann.net/2009/01/read-a-zip-file-comment-with-java/ Beerware.
    Since:
    0.8.8
    • Constructor Detail

      • ZipFileComment

        public ZipFileComment()
        Deprecated.
    • Method Detail

      • getComment

        public static String getComment​(File file,
                                        int max)
                                 throws IOException
        Deprecated.
        Parameters:
        max - The max length of the comment in bytes. If the actual comment is longer, it will not be found and this method will throw an IOE
        Returns:
        empty string if no comment, or the comment. The string is decoded with UTF-8
        Throws:
        IOException - if no valid end-of-central-directory record found
      • getComment

        public static String getComment​(File file,
                                        int max,
                                        int skip)
                                 throws IOException
        Deprecated.
        Parameters:
        max - The max length of the comment in bytes. If the actual comment is longer, it will not be found and this method will throw an IOE
        skip - Number of bytes to skip in the file before looking for the zip header. Use 56 for sud/su2 files.
        Returns:
        empty string if no comment, or the comment. The string is decoded with UTF-8
        Throws:
        IOException - if no valid end-of-central-directory record found