Class ByteCodeHelper


  • public class ByteCodeHelper
    extends Object
    A helper for reading byte code from various input sources.
    • Method Detail

      • readByteCode

        public static byte[] readByteCode​(InputStream inputStream)
                                   throws IOException
        Reads class byte array info from the given input stream. The stream is closed within this method!
        Parameters:
        inputStream - The stream containing the class binary; null will lead to an IOException
        Returns:
        The read bytes
        Throws:
        IOException - Indicates a problem accessing the given stream.
      • readByteCode

        public static byte[] readByteCode​(File file)
                                   throws IOException
        Read class definition from a file.
        Parameters:
        file - The file to read.
        Returns:
        The class bytes
        Throws:
        IOException - Indicates a problem accessing the given stream.
      • readByteCode

        public static byte[] readByteCode​(ZipInputStream zip)
                                   throws IOException
        Read class definition a zip (jar) file entry.
        Parameters:
        zip - The zip entry stream.
        Returns:
        The class bytes
        Throws:
        IOException - Indicates a problem accessing the given stream.