de.schlichtherle.io
Class AbstractArchiveDetector

java.lang.Object
  extended by de.schlichtherle.io.AbstractArchiveDetector
All Implemented Interfaces:
ArchiveDetector, FileFactory
Direct Known Subclasses:
DefaultArchiveDetector

public abstract class AbstractArchiveDetector
extends Object
implements ArchiveDetector

Implements the FileFactory part of the ArchiveDetector interface.

Since:
TrueZIP 6.0
Version:
TrueZIP 6.7
Author:
Christian Schlichtherle

Field Summary
 
Fields inherited from interface de.schlichtherle.io.ArchiveDetector
ALL, DEFAULT, NULL
 
Constructor Summary
AbstractArchiveDetector()
           
 
Method Summary
 File createFile(File blueprint)
          Constructs a new File instance from the given blueprint.
 File createFile(File delegate, File innerArchive)
          This factory method is not for public use - do not use it!
 File createFile(File blueprint, File delegate, File enclArchive)
          This factory method is not for public use - do not use it!
 File createFile(File parent, String child)
          Constructs a new File instance which uses this ArchiveDetector to detect any archive files in its pathname.
 File createFile(String pathName)
          Constructs a new File instance which uses this ArchiveDetector to detect any archive files in its pathname.
 File createFile(String parent, String child)
          Constructs a new File instance which uses this ArchiveDetector to detect any archive files in its pathname.
 File createFile(URI uri)
          Constructs a new File instance from the given uri.
 FileInputStream createFileInputStream(File file)
          Creates a new FileInputStream to read the content of the given file.
 FileOutputStream createFileOutputStream(File file, boolean append)
          Creates a new FileOutputStream to write the new content of the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.schlichtherle.io.ArchiveDetector
getArchiveDriver
 

Constructor Detail

AbstractArchiveDetector

public AbstractArchiveDetector()
Method Detail

createFile

public File createFile(File blueprint)
Description copied from interface: ArchiveDetector
Constructs a new File instance from the given blueprint.

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory
Parameters:
blueprint - The file to use as a blueprint. If this is an instance of the File class, its fields are simply copied.
Returns:
A newly created instance of the class File.

createFile

public File createFile(File delegate,
                       File innerArchive)
Description copied from interface: ArchiveDetector
This factory method is not for public use - do not use it!

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory

createFile

public File createFile(File blueprint,
                       File delegate,
                       File enclArchive)
Description copied from interface: ArchiveDetector
This factory method is not for public use - do not use it!

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory

createFile

public File createFile(File parent,
                       String child)
Description copied from interface: ArchiveDetector
Constructs a new File instance which uses this ArchiveDetector to detect any archive files in its pathname.

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory
Parameters:
parent - The parent pathname as a File.
child - The child pathname as a String.
Returns:
A newly created instance of the class File.

createFile

public File createFile(String pathName)
Description copied from interface: ArchiveDetector
Constructs a new File instance which uses this ArchiveDetector to detect any archive files in its pathname.

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory
Parameters:
pathName - The pathname of the file.
Returns:
A newly created instance of the class File.

createFile

public File createFile(String parent,
                       String child)
Description copied from interface: ArchiveDetector
Constructs a new File instance which uses this ArchiveDetector to detect any archive files in its pathname.

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory
Parameters:
parent - The parent pathname as a String.
child - The child pathname as a String.
Returns:
A newly created instance of the class File.

createFile

public File createFile(URI uri)
Description copied from interface: ArchiveDetector
Constructs a new File instance from the given uri. This method behaves similar to new java.io.File(uri) with the following amendment: If the URI matches the pattern (jar:)*file:(path!/)*entry, then the constructed file object treats the URI like a (possibly ZIPped) file.

The newly created File instance uses this ArchiveDetector to detect any archive files in its pathname.

Specified by:
createFile in interface ArchiveDetector
Specified by:
createFile in interface FileFactory
Parameters:
uri - an absolute, hierarchical URI with a scheme equal to file or jar, a non-empty path component, and undefined authority, query, and fragment components.
Returns:
A newly created instance of the class File.

createFileInputStream

public FileInputStream createFileInputStream(File file)
                                      throws FileNotFoundException
Description copied from interface: ArchiveDetector
Creates a new FileInputStream to read the content of the given file.

Specified by:
createFileInputStream in interface ArchiveDetector
Specified by:
createFileInputStream in interface FileFactory
Parameters:
file - The file to read.
Returns:
A newly created instance of the class FileInputStream.
Throws:
FileNotFoundException - On any I/O related issue when opening the file.

createFileOutputStream

public FileOutputStream createFileOutputStream(File file,
                                               boolean append)
                                        throws FileNotFoundException
Description copied from interface: ArchiveDetector
Creates a new FileOutputStream to write the new content of the given file.

Specified by:
createFileOutputStream in interface ArchiveDetector
Specified by:
createFileOutputStream in interface FileFactory
Parameters:
file - The file to write.
append - If true the new content should be appended to the old content rather than overwriting it.
Returns:
A newly created instance of the class FileOutputStream.
Throws:
FileNotFoundException - On any I/O related issue when opening the file.