Class FileMessage

  • All Implemented Interfaces:
    java.io.Serializable, ClusterMessage

    public class FileMessage
    extends ClusterMessageBase
    Contains the data for a file being transferred over TCP, this is essentially a fragment of a file, read and written by the FileMessageFactory.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FileMessage​(Member source, java.lang.String fileName, java.lang.String contextName)
      Creates a new FileMessage for transferring a file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getContextName()
      Returns the context name associated with this file transfer.
      byte[] getData()
      Returns the data payload of this message.
      int getDataLength()
      Returns the length of the valid data in the data array.
      java.lang.String getFileName()
      Returns the name of the file being transferred.
      int getMessageNumber()
      Returns the message number within the file transfer sequence.
      long getTotalNrOfMsgs()
      Returns the total number of messages in the file transfer.
      java.lang.String getUniqueId()
      Returns the unique identifier for this message.
      void setData​(byte[] data, int length)
      Sets the data payload and its length for this message.
      void setMessageNumber​(int messageNumber)
      Sets the message number within the file transfer sequence.
      void setTotalNrOfMsgs​(long totalNrOfMsgs)
      Sets the total number of messages in the file transfer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileMessage

        public FileMessage​(Member source,
                           java.lang.String fileName,
                           java.lang.String contextName)
        Creates a new FileMessage for transferring a file.
        Parameters:
        source - The member that is the source of this message
        fileName - The name of the file being transferred
        contextName - The name of the context associated with this file
    • Method Detail

      • getMessageNumber

        public int getMessageNumber()
        Returns the message number within the file transfer sequence.
        Returns:
        The message number
      • setMessageNumber

        public void setMessageNumber​(int messageNumber)
        Sets the message number within the file transfer sequence.
        Parameters:
        messageNumber - The message number
      • getTotalNrOfMsgs

        public long getTotalNrOfMsgs()
        Returns the total number of messages in the file transfer.
        Returns:
        The total number of messages
      • setTotalNrOfMsgs

        public void setTotalNrOfMsgs​(long totalNrOfMsgs)
        Sets the total number of messages in the file transfer.
        Parameters:
        totalNrOfMsgs - The total number of messages
      • getData

        public byte[] getData()
        Returns the data payload of this message.
        Returns:
        The data byte array
      • setData

        public void setData​(byte[] data,
                            int length)
        Sets the data payload and its length for this message.
        Parameters:
        data - The data byte array
        length - The length of valid data in the array
      • getDataLength

        public int getDataLength()
        Returns the length of the valid data in the data array.
        Returns:
        The data length
      • getUniqueId

        public java.lang.String getUniqueId()
        Description copied from interface: ClusterMessage
        Returns the unique identifier for this message.
        Returns:
        the unique ID
      • getFileName

        public java.lang.String getFileName()
        Returns the name of the file being transferred.
        Returns:
        The file name
      • getContextName

        public java.lang.String getContextName()
        Returns the context name associated with this file transfer.
        Returns:
        The context name