org.apache.aries.util.filesystem.impl
Class NestedZipFile

java.lang.Object
  extended by org.apache.aries.util.filesystem.impl.NestedZipFile
All Implemented Interfaces:
IFile
Direct Known Subclasses:
NestedZipDirectory

public class NestedZipFile
extends Object
implements IFile


Field Summary
protected  IFile archive
           
protected  NestedCloseableDirectory cache
           
 
Constructor Summary
NestedZipFile(IFile archive)
           
NestedZipFile(IFile archive, String pathInZip, NestedZipDirectory parent, NestedCloseableDirectory cache)
           
NestedZipFile(IFile archive, ZipEntry entry, NestedZipDirectory parent, NestedCloseableDirectory cache)
          Construct a nested zip file
NestedZipFile(NestedZipFile other, NestedCloseableDirectory cache)
           
 
Method Summary
 IDirectory convert()
           
 IDirectory convertNested()
           
 boolean equals(Object obj)
           
 long getLastModified()
           
 String getName()
           
 String getNameInZip()
           
 IDirectory getParent()
           
 IDirectory getRoot()
           
 long getSize()
           
 int hashCode()
           
 boolean isDirectory()
           
 boolean isFile()
           
 InputStream open()
          The input stream returned by this method should always be closed after use.
 String toString()
           
 URL toURL()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

archive

protected final IFile archive

cache

protected final NestedCloseableDirectory cache
Constructor Detail

NestedZipFile

public NestedZipFile(IFile archive,
                     ZipEntry entry,
                     NestedZipDirectory parent,
                     NestedCloseableDirectory cache)
Construct a nested zip file

Parameters:
archive -
entry -
parent -

NestedZipFile

public NestedZipFile(IFile archive,
                     String pathInZip,
                     NestedZipDirectory parent,
                     NestedCloseableDirectory cache)

NestedZipFile

public NestedZipFile(IFile archive)

NestedZipFile

public NestedZipFile(NestedZipFile other,
                     NestedCloseableDirectory cache)
Method Detail

getNameInZip

public String getNameInZip()

getName

public String getName()
Specified by:
getName in interface IFile
Returns:
the name of the file relative to the root of the virtual FS. This will return a '/' separated path indepedent of underlying filesystem

isDirectory

public boolean isDirectory()
Specified by:
isDirectory in interface IFile
Returns:
true iff this IFile is also an IDirectory

isFile

public boolean isFile()
Specified by:
isFile in interface IFile
Returns:
true iff this IFile is not an IDirectory

getLastModified

public long getLastModified()
Specified by:
getLastModified in interface IFile
Returns:
the last modified date of the file.

getSize

public long getSize()
Specified by:
getSize in interface IFile
Returns:
the size of the file.

convert

public IDirectory convert()
Specified by:
convert in interface IFile
Returns:
if this is a directory return this as an IDirectory, otherwise return null.

convertNested

public IDirectory convertNested()
Specified by:
convertNested in interface IFile
Returns:
if this is a directory or an archive, returns the opened IDirectory

getParent

public IDirectory getParent()
Specified by:
getParent in interface IFile
Returns:
returns the parent directory of this IFile, or null if this is the root.

open

public InputStream open()
                 throws IOException,
                        UnsupportedOperationException
Description copied from interface: IFile
The input stream returned by this method should always be closed after use.

Specified by:
open in interface IFile
Returns:
An InputStream to read the file from.
Throws:
IOException
UnsupportedOperationException - If the IFile is also an IDirectory.

getRoot

public IDirectory getRoot()
Specified by:
getRoot in interface IFile
Returns:
the root of this file system.

toURL

public URL toURL()
          throws MalformedURLException
Specified by:
toURL in interface IFile
Returns:
a URL that can be used to get at this file at a later date.
Throws:
MalformedURLException

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.