Interface ClassFileEntry


public interface ClassFileEntry
A single .class file abstraction. Relative path matches the package directory structure, and convenience methods to obtain the content.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the ClassFileInput that has produced this entry
    Return the relative path from the root of the archive/folder abstraction.
    long
    Returns the entry size in bytes.
    Returns the entry name.
    byte[]
    Read the content into a newly allocated byte[].
    int
    readAllBytes(byte[] bytes)
    Read the content of the file into an existing byte[]
    static String
    withDexExtension(String classFilePath)
    Takes the specified .class file, and changes its extension to .dex.
  • Method Details

    • name

      String name()
      Returns the entry name.
    • getSize

      long getSize() throws IOException
      Returns the entry size in bytes.
      Throws:
      IOException
    • getRelativePath

      String getRelativePath()
      Return the relative path from the root of the archive/folder abstraction.
    • getInput

      @NonNull ClassFileInput getInput()
      Return the ClassFileInput that has produced this entry
    • readAllBytes

      byte[] readAllBytes() throws IOException
      Read the content into a newly allocated byte[].
      Returns:
      file content as a byte[]
      Throws:
      IOException - failed to read the file.
    • readAllBytes

      int readAllBytes(byte[] bytes) throws IOException
      Read the content of the file into an existing byte[]
      Parameters:
      bytes - the bytes to read the content of the file into.
      Returns:
      the number of bytes read.
      Throws:
      IOException - failed to read the file or the buffer was too small.
    • withDexExtension

      @NonNull static String withDexExtension(@NonNull String classFilePath)
      Takes the specified .class file, and changes its extension to .dex. It fails if invoked with a file name that does not end in .class.