Package org.glassfish.rmic.tools.java
Class ClassFile
java.lang.Object
org.glassfish.rmic.tools.java.ClassFile
- Direct Known Subclasses:
FileClassFile
,PathClassFile
,ZipClassFile
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
exists()
Returns true if file exists.abstract String
Get absolute name of file entryabstract InputStream
Returns input stream to either regular file or zip file entryabstract String
getName()
Get name of file entry excluding directory nameabstract String
getPath()
Get file path.abstract boolean
Returns true if this is a directory.abstract boolean
isZipped()
Returns true if this is zip file entryabstract long
Return last modification timeabstract long
length()
Get length of filestatic ClassFile
newClassFile
(File file) Factory method to create a ClassFile backed by a File.static ClassFile
newClassFile
(Path path) Factory method to create a ClassFile backed by a nio Path.static ClassFile
newClassFile
(ZipFile zf, ZipEntry ze) Factory method to create a ClassFile backed by a ZipEntry.
-
Constructor Details
-
ClassFile
public ClassFile()
-
-
Method Details
-
newClassFile
Factory method to create a ClassFile backed by a File.- Parameters:
file
- a File object- Returns:
- a new ClassFile
-
newClassFile
Factory method to create a ClassFile backed by a ZipEntry.- Parameters:
zf
- a ZipFileze
- a ZipEntry within the zip file- Returns:
- a new ClassFile
-
newClassFile
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
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
Get file path. The path for a zip file entry will also include the zip file name. -
getName
Get name of file entry excluding directory name -
getAbsoluteName
Get absolute name of file entry -
length
public abstract long length()Get length of file
-