net.sf.cotta.utils
Class ClassPathEntry

java.lang.Object
  extended by net.sf.cotta.utils.ClassPathEntry
Direct Known Subclasses:
ClassPath

public class ClassPathEntry
extends java.lang.Object


Constructor Summary
ClassPathEntry(TDirectory directory)
           
ClassPathEntry(TFile file)
           
 
Method Summary
 void closeResource()
          Close the resource.
 TDirectory openAsDirectory()
          Use the class path entry as a TDirectory.
 java.lang.String path()
           
 void read(ClassPathEntryProcessor processor)
          Opens the class path entry, process its content, and close the resource
 ClassPathType type()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassPathEntry

public ClassPathEntry(TDirectory directory)

ClassPathEntry

public ClassPathEntry(TFile file)
Method Detail

type

public ClassPathType type()

openAsDirectory

public TDirectory openAsDirectory()
                           throws TIoException
Use the class path entry as a TDirectory. If the entry is a jar file, it will be opened and would require a close to be called. If you don't want to handle the resource management, you should use read method

Returns:
If the class path entry is a directory, the directory ponting to it, or if it is a zip file, to the root entry of it.
Throws:
TIoException - If the class path entry is pointing to a file that is not a zip format
See Also:
read(ClassPathEntryProcessor)

closeResource

public void closeResource()
                   throws TIoException
Close the resource. This is used to close the file if this class path entry is a zip file.

Throws:
TIoException - If close threw exception.

path

public java.lang.String path()
Returns:
The path string of this class path entry

read

public void read(ClassPathEntryProcessor processor)
          throws TIoException
Opens the class path entry, process its content, and close the resource

Parameters:
processor - The processor to call after openning the class path entry
Throws:
TIoException - for any read error