Class JavaClassObject

  • All Implemented Interfaces:
    javax.tools.FileObject, javax.tools.JavaFileObject

    public class JavaClassObject
    extends javax.tools.SimpleJavaFileObject
    A SimpleJavaFileObject that is used to store the bytes for a java class in memory.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface javax.tools.JavaFileObject

        javax.tools.JavaFileObject.Kind
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.ByteArrayOutputStream baos  
      • Fields inherited from class javax.tools.SimpleJavaFileObject

        kind, uri
    • Constructor Summary

      Constructors 
      Constructor Description
      JavaClassObject​(java.lang.String className, javax.tools.JavaFileObject.Kind kind)
      Create an instance for a given class name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBytes()
      Get the raw bytes for a class file.
      javax.tools.JavaFileObject.Kind getKind()
      java.io.OutputStream openOutputStream()
      • Methods inherited from class javax.tools.SimpleJavaFileObject

        delete, getAccessLevel, getCharContent, getLastModified, getName, getNestingKind, isNameCompatible, openInputStream, openReader, openWriter, toString, toUri
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • baos

        private final java.io.ByteArrayOutputStream baos
    • Constructor Detail

      • JavaClassObject

        public JavaClassObject​(java.lang.String className,
                               javax.tools.JavaFileObject.Kind kind)
        Create an instance for a given class name.
        Parameters:
        className - name of the class.
        kind - kind of the class.
    • Method Detail

      • getBytes

        public byte[] getBytes()
        Get the raw bytes for a class file.
        Returns:
        the raw bytes for a class file.
      • openOutputStream

        public java.io.OutputStream openOutputStream()
        Specified by:
        openOutputStream in interface javax.tools.FileObject
        Overrides:
        openOutputStream in class javax.tools.SimpleJavaFileObject
      • getKind

        public javax.tools.JavaFileObject.Kind getKind()
        Specified by:
        getKind in interface javax.tools.JavaFileObject
        Overrides:
        getKind in class javax.tools.SimpleJavaFileObject