© 2006-2007 ETH Zurich

org.ximtec.igesture.util
Class ZipFS

java.lang.Object
  extended by org.ximtec.igesture.util.ZipFS

public class ZipFS
extends Object

Simplifies the access to ZIP files. Java does not allow the modification of ZIP files. Therefore, a temporary file is used to do write operations. After a close, the original file is replaced by the temporary one.

Since:
igesture
Version:
1.0
Author:
UeliKurmann

Field Summary
static String SEPERATOR
           
 
Constructor Summary
ZipFS(File file)
           
ZipFS(String fileName)
           
 
Method Summary
 void close()
          Closes ZipFS
 void delete(String path)
          Marks an element to be ignored.
 ZipEntry getEntry(String path)
          Returns the ZipEntry with the given path.
 InputStream getInputStream(String path)
          Returns the input stream of a path.
 InputStream getInputStream(ZipEntry entry)
          Returns the input stream of a path.
static String getName(String path)
          Returns the substring after the last slash.
static String getName(ZipEntry zipEntry)
          Returns the name of a ZIP entry.
static String getParentPath(String path)
          Returns the parent path.
static String getParentPath(ZipEntry zipEntry)
          Returns the parent path of an element.
 List<ZipEntry> listFiles(String path)
          Lists all elements in a path (files and folders)
 void store(String path, InputStream stream)
          Stores a new element in the ZIP file with the given path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPERATOR

public static final String SEPERATOR
See Also:
Constant Field Values
Constructor Detail

ZipFS

public ZipFS(File file)
      throws IOException
Throws:
IOException

ZipFS

public ZipFS(String fileName)
      throws IOException
Throws:
IOException
Method Detail

getName

public static String getName(ZipEntry zipEntry)
Returns the name of a ZIP entry.

Parameters:
zipEntry -
Returns:

getName

public static String getName(String path)
Returns the substring after the last slash. If there is no slash, the entire string is returned.

Parameters:
path -
Returns:

getParentPath

public static String getParentPath(ZipEntry zipEntry)
Returns the parent path of an element. If no parent path is available, an EMPTY string is returned.

Parameters:
zipEntry -
Returns:
See Also:
getParentPath(String path)

getParentPath

public static String getParentPath(String path)
Returns the parent path. If no path is available, an EMPTY string is returned.

Parameters:
path -
Returns:

listFiles

public List<ZipEntry> listFiles(String path)
Lists all elements in a path (files and folders)

Parameters:
path -
Returns:

getInputStream

public InputStream getInputStream(String path)
                           throws IOException
Returns the input stream of a path.

Parameters:
path -
Returns:
Throws:
IOException

getInputStream

public InputStream getInputStream(ZipEntry entry)
                           throws IOException
Returns the input stream of a path.

Parameters:
entry -
Returns:
Throws:
IOException

getEntry

public ZipEntry getEntry(String path)
                  throws IOException
Returns the ZipEntry with the given path.

Parameters:
path -
Returns:
Throws:
IOException

delete

public void delete(String path)
Marks an element to be ignored.

Parameters:
path -

store

public void store(String path,
                  InputStream stream)
           throws IOException
Stores a new element in the ZIP file with the given path.

Parameters:
path -
stream -
Throws:
IOException

close

public void close()
           throws IOException
Closes ZipFS

Throws:
IOException

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.