Package org.glassfish.rmic.tools.java
Class ClassFile
- java.lang.Object
-
- org.glassfish.rmic.tools.java.ClassFile
-
- Direct Known Subclasses:
FileClassFile
,PathClassFile
,ZipClassFile
public abstract class ClassFile extends java.lang.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 Summary
Constructors Constructor Description ClassFile()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
exists()
Returns true if file exists.abstract java.lang.String
getAbsoluteName()
Get absolute name of file entryabstract java.io.InputStream
getInputStream()
Returns input stream to either regular file or zip file entryabstract java.lang.String
getName()
Get name of file entry excluding directory nameabstract java.lang.String
getPath()
Get file path.abstract boolean
isDirectory()
Returns true if this is a directory.abstract boolean
isZipped()
Returns true if this is zip file entryabstract long
lastModified()
Return last modification timeabstract long
length()
Get length of filestatic ClassFile
newClassFile(java.io.File file)
Factory method to create a ClassFile backed by a File.static ClassFile
newClassFile(java.nio.file.Path path)
Factory method to create a ClassFile backed by a nio Path.static ClassFile
newClassFile(java.util.zip.ZipFile zf, java.util.zip.ZipEntry ze)
Factory method to create a ClassFile backed by a ZipEntry.
-
-
-
Method Detail
-
newClassFile
public static ClassFile newClassFile(java.io.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(java.util.zip.ZipFile zf, java.util.zip.ZipEntry ze)
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
public static ClassFile newClassFile(java.nio.file.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 java.io.InputStream getInputStream() throws java.io.IOException
Returns input stream to either regular file or zip file entry- Throws:
java.io.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 java.lang.String getPath()
Get file path. The path for a zip file entry will also include the zip file name.
-
getName
public abstract java.lang.String getName()
Get name of file entry excluding directory name
-
getAbsoluteName
public abstract java.lang.String getAbsoluteName()
Get absolute name of file entry
-
length
public abstract long length()
Get length of file
-
-