Class EncodeUtils


  • public class EncodeUtils
    extends java.lang.Object
    Utilities to encode and decode file names in zips.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean canAsciiEncode​(java.lang.String text)
      Checks if some text may be encoded using ASCII.
      static java.lang.String decode​(byte[] data, com.android.tools.build.apkzlib.zip.GPFlags flags)
      Decodes a file name.
      static java.lang.String decode​(java.nio.ByteBuffer bytes, int length, com.android.tools.build.apkzlib.zip.GPFlags flags)
      Decodes a file name.
      static byte[] encode​(java.lang.String name, com.android.tools.build.apkzlib.zip.GPFlags flags)
      Encodes a file name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • decode

        public static java.lang.String decode​(java.nio.ByteBuffer bytes,
                                              int length,
                                              com.android.tools.build.apkzlib.zip.GPFlags flags)
                                       throws java.io.IOException
        Decodes a file name.
        Parameters:
        bytes - the raw data buffer to read from
        length - the number of bytes in the raw data buffer containing the string to decode
        flags - the zip entry flags
        Returns:
        the decode file name
        Throws:
        java.io.IOException
      • decode

        public static java.lang.String decode​(byte[] data,
                                              com.android.tools.build.apkzlib.zip.GPFlags flags)
        Decodes a file name.
        Parameters:
        data - the raw data
        flags - the zip entry flags
        Returns:
        the decode file name
      • encode

        public static byte[] encode​(java.lang.String name,
                                    com.android.tools.build.apkzlib.zip.GPFlags flags)
        Encodes a file name.
        Parameters:
        name - the name to encode
        flags - the zip entry flags
        Returns:
        the encoded file name
      • canAsciiEncode

        public static boolean canAsciiEncode​(java.lang.String text)
        Checks if some text may be encoded using ASCII.
        Parameters:
        text - the text to check
        Returns:
        can it be encoded using ASCII?