Class ClassFile

java.lang.Object
org.glassfish.rmic.tools.java.ClassFile
Direct Known Subclasses:
FileClassFile, PathClassFile, ZipClassFile

public abstract class ClassFile extends Object
Abstract class to represent a class file. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
  • Constructor Details

    • ClassFile

      public ClassFile()
  • Method Details

    • newClassFile

      public static ClassFile newClassFile(File file)
      Factory method to create a ClassFile backed by a File.
      Parameters:
      file - a File object
      Returns:
      a new ClassFile
    • newClassFile

      public static ClassFile newClassFile(ZipFile zf, ZipEntry ze)
      Factory method to create a ClassFile backed by a ZipEntry.
      Parameters:
      zf - a ZipFile
      ze - a ZipEntry within the zip file
      Returns:
      a new ClassFile
    • newClassFile

      public static ClassFile newClassFile(Path path)
      Factory method to create a ClassFile backed by a nio Path.
      Parameters:
      path - nio Path object
      Returns:
      a new ClassFile
    • isZipped

      public abstract boolean isZipped()
      Returns true if this is zip file entry
    • getInputStream

      public abstract InputStream getInputStream() throws IOException
      Returns input stream to either regular file or zip file entry
      Throws:
      IOException
    • exists

      public abstract boolean exists()
      Returns true if file exists.
    • isDirectory

      public abstract boolean isDirectory()
      Returns true if this is a directory.
    • lastModified

      public abstract long lastModified()
      Return last modification time
    • getPath

      public abstract String getPath()
      Get file path. The path for a zip file entry will also include the zip file name.
    • getName

      public abstract String getName()
      Get name of file entry excluding directory name
    • getAbsoluteName

      public abstract String getAbsoluteName()
      Get absolute name of file entry
    • length

      public abstract long length()
      Get length of file