Class GetFileMessage

  • All Implemented Interfaces:
    Serializable

    public class GetFileMessage
    extends ArchiveMessage
    Message requesting a file from a bitarchive. Messages is forwarded through arcrepository, but reponds directly to sender.
    See Also:
    Serialized Form
    • Constructor Detail

      • GetFileMessage

        public GetFileMessage​(ChannelID to,
                              ChannelID replyTo,
                              String arcfileName,
                              String replicaId)
        Constructor for get file message.
        Parameters:
        to - Recipient
        replyTo - Original sender
        arcfileName - The file to retrieve
        replicaId - The bitarchive replica id to retrieve it from.
    • Method Detail

      • setFile

        public void setFile​(File data)
        Set the file this message should return. Note: This will make a remote file handle fopr the file.
        Parameters:
        data - Content of the file to retrieve
      • getData

        public void getData​(File toFile)
                     throws ArgumentNotValid,
                            IOFailure
        Writes the the content of the retrieved file into a local file. Note: This is transferred through a remote file handle, and then the handle is invalidated. This method may only be called once.
        Parameters:
        toFile - where to write the content
        Throws:
        IOFailure - on error reading the remote file or writing the local file
        ArgumentNotValid - If the file is null.
      • getReplicaId

        public String getReplicaId()
        Retrieve the replica id.
        Returns:
        replica id
      • getArcfileName

        public String getArcfileName()
        Get name of the file to retrieve.
        Returns:
        file name
      • clearBuffer

        public void clearBuffer()
        Clear content buffer.