Class ZipArchive
java.lang.Object
com.blackrook.fs.FSFileArchive
com.blackrook.fs.archive.ZipArchive
This is an FS wrapping class for wrapping a zip file on the native file system.
- Author:
- Matthew Tropiano
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionZipArchive(File path) Constructs a new zip archive from an abstract file.ZipArchive(String path) Constructs a new zip archive from an abstract path.Constructs a new zip archive from a file object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCan this archive create a new file within itself?createFile(String path) Creates a file in this archive using the name and path provided.FSFile[]Retrieves all of the files within this object as FSFile objects.FSFile[]getAllFiles(FSFileFilter filter) Retrieves all of the files within this object that pass the filter test as FSFile objects.FSFile[]getAllFilesInDir(String path) Retrieves all of the files within a directory as FSFile objects.FSFile[]getAllFilesInDir(String path, FSFileFilter filter) Retrieves all of the files within this object as FSFile objects that pass the filter test.Returns an FSFile reference of a file within this wrapped file.Methods inherited from class FSFileArchive
getArchiveName, getPath, setArchiveName, setPath
-
Field Details
-
fileLookupTable
-
zipfileRef
Zip file reference.
-
-
Constructor Details
-
ZipArchive
Constructs a new zip archive from an abstract path.- Parameters:
path- a path to a zip file on the native file system.- Throws:
FileSystemException- if the path refers to a location that is not a folder.ZipException- if something is wrong with the Zip file.IOException- if something is wrong with the file.NullPointerException- if path is null.
-
ZipArchive
Constructs a new zip archive from an abstract file.- Parameters:
path- a path to a zip file on the native file system.- Throws:
FileSystemException- if the path refers to a location that is not a folder.ZipException- if something is wrong with the Zip file.IOException- if something is wrong with the file.NullPointerException- if path is null.
-
ZipArchive
Constructs a new zip archive from a file object.- Parameters:
f- a file that is a zip file on the native file system.- Throws:
FileSystemException- if the file refers to a location that is not a folder.ZipException- if something is wrong with the Zip file.IOException- if something is wrong with the file.NullPointerException- if f is null.
-
-
Method Details
-
getFile
Description copied from class:FSFileArchiveReturns an FSFile reference of a file within this wrapped file.- Specified by:
getFilein classFSFileArchive- Parameters:
path- the abstract path of a file inside this file.- Returns:
- a new reference to the file requested, or null if the path refers to a location that is not inside this file.
-
getAllFiles
Description copied from class:FSFileArchiveRetrieves all of the files within this object as FSFile objects.- Specified by:
getAllFilesin classFSFileArchive- Returns:
- an array of FSFiles, each entry representing a particular file in this object.
-
getAllFiles
Description copied from class:FSFileArchiveRetrieves all of the files within this object that pass the filter test as FSFile objects.- Specified by:
getAllFilesin classFSFileArchive- Parameters:
filter- the file filter to use.- Returns:
- an array of FSFiles, each entry representing a particular file in this object.
-
getAllFilesInDir
Description copied from class:FSFileArchiveRetrieves all of the files within a directory as FSFile objects.- Specified by:
getAllFilesInDirin classFSFileArchive- Parameters:
path- the abstract path of a directory inside this file.- Returns:
- an array of FSFiles, each entry representing a particular file in this object.
-
getAllFilesInDir
Description copied from class:FSFileArchiveRetrieves all of the files within this object as FSFile objects that pass the filter test.- Specified by:
getAllFilesInDirin classFSFileArchive- Parameters:
path- the abstract path of a directory inside this file.filter- the file filter to use.- Returns:
- an array of FSFiles, each entry representing a particular file in this object.
-
canCreateFiles
public boolean canCreateFiles()Description copied from class:FSFileArchiveCan this archive create a new file within itself?- Specified by:
canCreateFilesin classFSFileArchive- Returns:
- true if it can, false if it is read-only.
-
createFile
Description copied from class:FSFileArchiveCreates a file in this archive using the name and path provided.- Specified by:
createFilein classFSFileArchive- Parameters:
path- the path of the file to create.- Returns:
- an acceptable OutputStream for filling the file with data.
- Throws:
IOException- if a read error occurs during the fetch.
-