org.pf.file
Class TableOfContents

java.lang.Object
  extended by org.pf.file.TableOfContents

public class TableOfContents
extends java.lang.Object

An instance of this class contains a list of DirectoryContnts objects. The purpose is to hold in one object all directory and file information from either an archive (zip/jar) or a base direcory (e.g. "/usr/apps/conf").
To represent both types in a common information structure allows to present or analyze the content information in a common way.

Version:
1.0
Author:
Manfred Duchrow

Constructor Summary
TableOfContents(java.lang.String name)
          Initialize the new instance with default values.
 
Method Summary
 void add(DirectoryContents dir)
          Adds the given directory contents holder to the table of contents
 DirectoryContents dirContentAt(int index)
          Returns the DirectoryContents entry at the specified index.
 java.lang.String dirNameAt(int index)
          Returns the name of the directory entry at the specified index.
 FileInfo[] filesAt(int index)
          Returns the file info objects of the directory entry at the specified index.
 DirectoryContents[] getDirectories()
          Returns all contained directories
 java.lang.String getName()
          Returns the name of the container this table of contents belongs to
 int size()
          Returns the number of directory entries in this table of contents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableOfContents

public TableOfContents(java.lang.String name)
Initialize the new instance with default values.

Method Detail

getName

public java.lang.String getName()
Returns the name of the container this table of contents belongs to


add

public void add(DirectoryContents dir)
Adds the given directory contents holder to the table of contents


getDirectories

public DirectoryContents[] getDirectories()
Returns all contained directories


size

public int size()
Returns the number of directory entries in this table of contents


dirContentAt

public DirectoryContents dirContentAt(int index)
Returns the DirectoryContents entry at the specified index.

Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is not valid

dirNameAt

public java.lang.String dirNameAt(int index)
Returns the name of the directory entry at the specified index.

Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is not valid

filesAt

public FileInfo[] filesAt(int index)
Returns the file info objects of the directory entry at the specified index.

Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is not valid