Package dk.netarkivet.common.distribute
Class FileRemoteFile
- java.lang.Object
-
- dk.netarkivet.common.distribute.FileRemoteFile
-
- All Implemented Interfaces:
RemoteFile
,Serializable
public class FileRemoteFile extends Object implements RemoteFile
A file represented as a RemoteFile. To avoid transferring data to and from a remote machine, when you now, that recipient is a local process. The file is deleted during cleanup.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FileRemoteFile(File dataFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendTo(OutputStream out)
Write the contents of this remote file to an output stream.void
cleanup()
Cleanup this remote file.void
copyTo(File destFile)
Copy remotefile to local disk storage.String
getChecksum()
Returns a MD5 Checksum on the file.InputStream
getInputStream()
Get an inputstream that contains the data transferred in this RemoteFile.String
getName()
Return the file name.long
getSize()
Returns the total size of the remote file.
-
-
-
Constructor Detail
-
FileRemoteFile
public FileRemoteFile(File dataFile)
-
-
Method Detail
-
copyTo
public void copyTo(File destFile)
Description copied from interface:RemoteFile
Copy remotefile to local disk storage. Used by the data recipient- Specified by:
copyTo
in interfaceRemoteFile
- Parameters:
destFile
- local File
-
appendTo
public void appendTo(OutputStream out)
Description copied from interface:RemoteFile
Write the contents of this remote file to an output stream.- Specified by:
appendTo
in interfaceRemoteFile
- Parameters:
out
- OutputStream that the data will be written to. This stream will not be closed by this operation.
-
getInputStream
public InputStream getInputStream()
Description copied from interface:RemoteFile
Get an inputstream that contains the data transferred in this RemoteFile.- Specified by:
getInputStream
in interfaceRemoteFile
- Returns:
- A stream object with the data in the object. Note that the close() method of this may throw exceptions if e.g. a transmission error is detected.
-
getName
public String getName()
Description copied from interface:RemoteFile
Return the file name.- Specified by:
getName
in interfaceRemoteFile
- Returns:
- the file name
-
getChecksum
public String getChecksum()
Description copied from interface:RemoteFile
Returns a MD5 Checksum on the file. May return null, if checksums not supported for this operation.- Specified by:
getChecksum
in interfaceRemoteFile
- Returns:
- MD5 checksum
-
cleanup
public void cleanup()
Description copied from interface:RemoteFile
Cleanup this remote file. The file is invalid after this.- Specified by:
cleanup
in interfaceRemoteFile
-
getSize
public long getSize()
Description copied from interface:RemoteFile
Returns the total size of the remote file.- Specified by:
getSize
in interfaceRemoteFile
- Returns:
- Size of the remote file.
-
-