Class ClassFileSource
java.lang.Object
com.sun.jdo.api.persistence.enhancer.util.Assertion
com.sun.jdo.api.persistence.enhancer.util.Support
com.sun.jdo.api.persistence.enhancer.util.ClassFileSource
ClassFileSource provides a mechanism for associating a class
with the source of that class. The source is currently either
an ordinary .class file or a zip file 1 or more class files.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionClassFileSource(String className, File classFile) ConstructorClassFileSource(String className, InputStream byteCodeStream) ConstructorClassFileSource(String className, ZipFile zipFile) Constructor -
Method Summary
Modifier and TypeMethodDescriptionGet a DataInputStream containing the class file.computeDestination(File destDir) Compute the destination file for the class.Get the path of the File containing the classThe expected name of the class contained in the class file.friendSource(String className) Build a "friend" source file specification for the class of the given name.getOutputStream(File dest) Get a DataOutputStream to which a class file should be written.booleanDoes this class originate in a zip file?booleanisZipped()Does this class originate in a zip file?longGet the modification date of the class file.nextSource(String className) Attempt to find the next possible source of the classbooleansameAs(ClassFileSource other) Does the other class file source refer to the same source location?voidsetExpectedClassName(String name) Set the name of the class contained in the class file.voidsetModificationDate(long date) Set the cached modification date of the class file.Methods inherited from class com.sun.jdo.api.persistence.enhancer.util.Support
getI18N, getI18N, getI18N, getI18N, getI18N, getI18N
-
Constructor Details
-
ClassFileSource
Constructor- Parameters:
className- The expected name of the classclassFile- The file containing the class. This file should exist and be readable.
-
ClassFileSource
Constructor- Parameters:
className- The expected name of the classzipFile- The zip file containing the class. This file should exist and be readable.
-
ClassFileSource
Constructor- Parameters:
className- The expected name of the classbyteCodeStream- containing the class file.
-
-
Method Details
-
sameAs
Does the other class file source refer to the same source location? -
isZipped
public boolean isZipped()Does this class originate in a zip file? -
isStreamed
public boolean isStreamed()Does this class originate in a zip file? -
expectedClassName
The expected name of the class contained in the class file. Returns null if the class name can not be intuited from the file name. -
setExpectedClassName
Set the name of the class contained in the class file. -
containingFilePath
Get the path of the File containing the class -
nextSource
Attempt to find the next possible source of the class -
friendSource
Build a "friend" source file specification for the class of the given name. That is, the new class file source should be in the same zip file if zipped or else the same directory. Restriction: containingFilePath() must be non-null. -
classFileContents
Get a DataInputStream containing the class file. Restriction: containingFilePath() must be non-null.- Throws:
IOExceptionFileNotFoundException
-
modificationDate
Get the modification date of the class file. The date format is that used by java.util.Date. Restriction: containingFilePath() must be non-null.- Throws:
FileNotFoundException
-
setModificationDate
public void setModificationDate(long date) Set the cached modification date of the class file. This doesn't actually update the file. -
computeDestination
Compute the destination file for the class. If destDir is non-null, use that as a destination location Restriction: if containingFilePath() is null, null is returned.- Throws:
IOExceptionFileNotFoundException
-
getOutputStream
Get a DataOutputStream to which a class file should be written. The caller must close the output stream when complete.- Throws:
IOExceptionFileNotFoundException
-