org.entityfs.zip.cap.fs
Class FSCZipFileBackedUtil

java.lang.Object
  extended by org.entityfs.zip.cap.fs.FSCZipFileBackedUtil

public final class FSCZipFileBackedUtil
extends Object

This is a utility class with static utility methods for working with file systems supporting the FSCZipFileBacked capability.

Since:
1.0
Author:
Karl Gustafsson
See Also:
FSCZipFileBacked

Method Summary
static FileSystem getParentFileSystem(FileSystem fs)
          Return the file system where the backing ZipFile is.
static ZipFile getZipFile(FileSystem fs)
          Get the ZipFile backing the Zip file system, if it can be constructed.
static boolean hasParentFileSystem(FileSystem fs)
          Does the Zip file system have a parent file system? If the Zip file system was created on a Zip EFile, it has.
static boolean hasZipFile(FileSystem fs)
          Check if the Zip file-backed file system can return a ZipFile object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getZipFile

public static ZipFile getZipFile(FileSystem fs)
                          throws UnsupportedCapabilityException
Get the ZipFile backing the Zip file system, if it can be constructed.

Parameters:
fs - The file system.
Returns:
The Zip file system's backing Zip file, or null if it cannot be constructed.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCZipFileBacked capability.

hasZipFile

public static boolean hasZipFile(FileSystem fs)
                          throws UnsupportedCapabilityException
Check if the Zip file-backed file system can return a ZipFile object. If the file system was created on an empty (size 0) file, it cannot.

Parameters:
fs - The file system to check for.
Returns:
true if the Zip file-backed file system can return a ZipFile object.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCZipFileBacked capability.

getParentFileSystem

public static FileSystem getParentFileSystem(FileSystem fs)
                                      throws UnsupportedCapabilityException
Return the file system where the backing ZipFile is. This works if the Zip file system was created on an EFile Zip file.

Parameters:
fs - The Zip file system.
Returns:
The Zip file system's parent file system, if it has one.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCZipFileBacked capability.

hasParentFileSystem

public static boolean hasParentFileSystem(FileSystem fs)
                                   throws UnsupportedCapabilityException
Does the Zip file system have a parent file system? If the Zip file system was created on a Zip EFile, it has.

Parameters:
fs - The Zip file system.
Returns:
true if the Zip file system has a parent file system, false if not.
Throws:
UnsupportedCapabilityException - If the file system does not support the FSCZipFileBacked capability.