org.xnap.plugin.opennap.util
Class OpenNapBinaryResumeRepository

java.lang.Object
  extended by org.xnap.plugin.opennap.util.OpenNapBinaryResumeRepository

public class OpenNapBinaryResumeRepository
extends java.lang.Object

Provides a binary repository that stores File objects. This class can be used to store download files that need to be resumed later.

This class is mostly thread safe (except for iterator()).


Field Summary
static java.lang.String FILENAME
           
 
Constructor Summary
OpenNapBinaryResumeRepository()
           
 
Method Summary
 void add(OpenNapDownloadContainerData data)
          Adds file to the repository.
 java.util.Iterator iterator()
          Returns an iterator over all items in the repository.
 boolean read()
          Reads File objects from filename and adds them to the repository.
 void remove(OpenNapDownloadContainerData data)
          Removes file from the repository.
 void write(java.lang.String filename)
          Writes repository content to filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME

public static final java.lang.String FILENAME
Constructor Detail

OpenNapBinaryResumeRepository

public OpenNapBinaryResumeRepository()
Method Detail

add

public void add(OpenNapDownloadContainerData data)
Adds file to the repository.


iterator

public java.util.Iterator iterator()
Returns an iterator over all items in the repository.


read

public boolean read()
             throws java.io.IOException
Reads File objects from filename and adds them to the repository.

Parameters:
filename - the name of the repository file
fallbackPath - if a file in the repository does not exist, it is looked up in this path
Returns:
true, if all File objects were read successfully or repository did not exist; false, otherwise
Throws:
java.io.IOException
See Also:
#add(File)

remove

public void remove(OpenNapDownloadContainerData data)
Removes file from the repository.


write

public void write(java.lang.String filename)
           throws java.io.IOException
Writes repository content to filename.

Throws:
java.io.IOException


Copyright © 2001-2005 XNap Team. All Rights Reserved.