|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.distribute.AbstractRemoteFile
public abstract class AbstractRemoteFile
Abstract superclass for easy implementation of remote file. Sub classes should override this class, and do the following: - Implement getChecksum. - Implement getInputStream. - Implement cleanup. - Add getInstance(File, Boolean, Boolean, Boolean)-method to make the file work with the factory.
Field Summary | |
---|---|
protected java.io.File |
file
The file this is remote file for |
protected boolean |
fileDeletable
If true, the file may be deleted after all transfers are done. |
protected long |
filesize
The size of the file. |
protected boolean |
multipleDownloads
If true, the file may be downloaded multiple times. |
protected boolean |
useChecksums
If true, communication is checksummed. |
Constructor Summary | |
---|---|
AbstractRemoteFile(java.io.File file,
boolean useChecksums,
boolean fileDeletable,
boolean multipleDownloads)
Initialise common fields in remote file. |
Method Summary | |
---|---|
void |
appendTo(java.io.OutputStream out)
Append this remote file to the given output stream. |
abstract void |
cleanup()
Invalidate all file handles. |
void |
copyTo(java.io.File destFile)
Copy this remote file to the given file. |
abstract java.lang.String |
getChecksum()
Get checksum for file, or null if checksums were not requested. |
abstract java.io.InputStream |
getInputStream()
Get an input stream representing the remote file. |
java.lang.String |
getName()
Get the name of the remote file. |
abstract int |
getNumberOfRetries()
Method for retrieving the number of retries for retrieving a file. |
long |
getSize()
Get the size of this remote file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.io.File file
protected final boolean useChecksums
protected final boolean fileDeletable
protected final boolean multipleDownloads
protected final long filesize
Constructor Detail |
---|
public AbstractRemoteFile(java.io.File file, boolean useChecksums, boolean fileDeletable, boolean multipleDownloads)
file
- The file to make remote file for.useChecksums
- If true, communications should be checksummed.fileDeletable
- If true, the file may be downloaded multiple times.
Otherwise, the remote file is invalidated after first transfer.multipleDownloads
- If useChecksums is true, contains the file
checksum.Method Detail |
---|
public void copyTo(java.io.File destFile)
copyTo
in interface RemoteFile
destFile
- The file to write the remote file to.
ArgumentNotValid
- on null destFile, or parent to destfile is not
a writeable directory, or destfile exists and cannot be overwritten.
IOFailure
- on I/O trouble writing remote file to destination.public void appendTo(java.io.OutputStream out)
appendTo
in interface RemoteFile
out
- The stream to write the remote file to.
ArgumentNotValid
- if outputstream is null.
IOFailure
- on I/O trouble writing remote file to stream.public abstract java.io.InputStream getInputStream()
getInputStream
in interface RemoteFile
IOFailure
- on I/O trouble generating inputstream for remote file.public java.lang.String getName()
getName
in interface RemoteFile
public abstract java.lang.String getChecksum()
getChecksum
in interface RemoteFile
public abstract void cleanup()
cleanup
in interface RemoteFile
public abstract int getNumberOfRetries()
public long getSize()
getSize
in interface RemoteFile
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |