eap.tar
Interface Archive

All Known Implementing Classes:
TarFile

public interface Archive

Provides a general framework for reading a collection of directories and files. Currently only tar format files are supported, but this could be extended to other uses. It would be simple to make a class for reading zip files, since Java already has support for zip files. The source of data does not need to be a single archive file. For example you could write a class which would mirror a directory structure from an FTP site.


Method Summary
 String getEntryName()
          Returns the name of the current archive entry.
 InputStream getStream()
          Returns a stream which will read the current file.
 boolean hasNextEntry()
          Tests if there are more entries in this archive after the current one.
 boolean isDirectory()
          Tests If the current entry is a directory.
 boolean isFile()
          Tests If the current entry is a regular file.
 void nextEntry()
          Advances to the next entry in the archive.
 

Method Detail

nextEntry

public void nextEntry()
               throws IOException
Advances to the next entry in the archive. This may invalidate input streams returned by previous calls to getStream(). When an archive object is created, it should already be positioned at the first entry in the archive.

Throws:
IOException

hasNextEntry

public boolean hasNextEntry()
Tests if there are more entries in this archive after the current one.

Returns:
true if there are more entries in this archive.

getEntryName

public String getEntryName()
Returns the name of the current archive entry.

Returns:
The name of the current archive entry.

isDirectory

public boolean isDirectory()
Tests If the current entry is a directory.

Returns:
true if the current entry is a directory.

isFile

public boolean isFile()
Tests If the current entry is a regular file.

Returns:
true if the current entry is a regular file.

getStream

public InputStream getStream()
Returns a stream which will read the current file. The input stream returned must signal EOF when it reaches the end of the current file. The returned stream may be invalidated by a call to nextEntry(). This method should only be called once per entry. The behavior of the streams returned is not specified if this method is called more than once.

Returns:
An InputStream for reading the current file, or null if the current entry is not a regular file.