at.ac.tuwien.infosys.rnue.helpers.search
Class FileListImpl

java.lang.Object
  |
  +--at.ac.tuwien.infosys.rnue.helpers.search.FileListImpl
All Implemented Interfaces:
IFileList, java.io.Serializable

public class FileListImpl
extends java.lang.Object
implements IFileList

An object of the class FileListImpl represents a list of files which can be reached on a peer with a specific URL prefix.

It provides a constructor to set the URL prefix and to put the files into the FileListIMPL.

See Also:
Serialized Form

Constructor Summary
FileListImpl(java.lang.String downloadURLPrefix, IFile[] fileArray)
          Constructs a FileListImpl object.
 
Method Summary
 java.util.Enumeration files()
          Returns an java.lang.Enumeartion of the FileList elements.
 java.lang.String getDownloadURLPrefix()
          Returns the URL prefix.
 void printToStream(java.io.OutputStream os)
          Prints the file list elements (path + file name + (size)) on the given java.io.OutputStream.
 int size()
          Returns the number of entries in the file list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileListImpl

public FileListImpl(java.lang.String downloadURLPrefix,
                    IFile[] fileArray)
Constructs a FileListImpl object.

Parameters:
downloadURLPrefix - java.lang.String representing the protocol, host, and port number of the ShareMe peer to access the files in the FileList. The string must have the following format:
{protocol}"://"{host}":"{port} (e.g. "http://pent223.infosys.tuwien.ac.at:10003")
fileArray - array of IFile files to be put into the FileList.
Method Detail

getDownloadURLPrefix

public java.lang.String getDownloadURLPrefix()
Returns the URL prefix.

Specified by:
getDownloadURLPrefix in interface IFileList
Returns:
URL prefix

files

public java.util.Enumeration files()
Returns an java.lang.Enumeartion of the FileList elements.

Specified by:
files in interface IFileList
Returns:
java.lang.Enumeartion of IFile elements in the list.

size

public int size()
Returns the number of entries in the file list.

Specified by:
size in interface IFileList
Returns:
number of elements

printToStream

public void printToStream(java.io.OutputStream os)
                   throws ShareMeException
Prints the file list elements (path + file name + (size)) on the given java.io.OutputStream.

Specified by:
printToStream in interface IFileList
Parameters:
os - java.io.OutStream to write the file list at.
Throws:
ShareMeException - If no output stream passed to print.