Spreadsheet Toolkit

corpus.fileIO
Class Directory

java.lang.Object
  |
  +--corpus.fileIO.Directory

public class Directory
extends java.lang.Object

Used to represent a file system directory. Basically a specialised version of File.

See Also:
File

Constructor Summary
Directory(java.io.File directory)
          Create this Directory Object for the given File
Directory(java.lang.String directoryName)
          Create this Directory Object from a path to a file system directory.
 
Method Summary
static Directory browse(Directory root, java.lang.String title)
           
 java.lang.String[] contentsPaths()
          Creates a String[] containing the path for each file/directory in this Directory.
static Directory create(java.lang.String path)
          Create a new directory for the given path.
 java.lang.String[] getFiles()
           
 java.lang.String getName()
           
 java.lang.String getParentPath()
           
 java.lang.String getPath()
           
 java.lang.String[] getSubDirs()
           
 java.lang.String[] getSubFiles()
          Used if no files can be found in the current directory
static void main(java.lang.String[] args)
          This program lists the contents of a directory specified by the user.
 int numSubDirs()
           
 int numSubFiles()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Directory

public Directory(java.io.File directory)
Create this Directory Object for the given File

Parameters:
directory - a File which is also a Directory.

Directory

public Directory(java.lang.String directoryName)
Create this Directory Object from a path to a file system directory.

Method Detail

create

public static Directory create(java.lang.String path)
Create a new directory for the given path.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getPath

public java.lang.String getPath()

getName

public java.lang.String getName()

getParentPath

public java.lang.String getParentPath()

getSubDirs

public java.lang.String[] getSubDirs()

numSubDirs

public int numSubDirs()

getFiles

public java.lang.String[] getFiles()

numSubFiles

public int numSubFiles()

getSubFiles

public java.lang.String[] getSubFiles()
Used if no files can be found in the current directory


contentsPaths

public java.lang.String[] contentsPaths()
Creates a String[] containing the path for each file/directory in this Directory.


browse

public static Directory browse(Directory root,
                               java.lang.String title)

main

public static void main(java.lang.String[] args)
This program lists the contents of a directory specified by the user. The contents of subdirectories are also listed, up to any level of nesting. Indentation is used to show the level of nesting. The user is asked to type in a directory name. If the name entered by the user is not a directory, a message is printed and the program ends.


Spreadsheet Toolkit

Project Home Page