# Class FileMessage

java.lang.Object
org.apache.catalina.ha.ClusterMessageBase
org.apache.catalina.ha.deploy.FileMessage

All Implemented Interfaces:
  `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

- ## Field Summary

  ### Fields inherited from class ClusterMessageBase

  `address`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FileMessage(Member source, String fileName, String contextName)`
  Creates a new FileMessage for transferring a file.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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.
  `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.
  `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 ClusterMessageBase

  `getAddress, getTimestamp, setAddress, setTimestamp`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### FileMessage

    public FileMessage(Member source, String fileName, 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 Details

  - ### 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 String getUniqueId()
    Description copied from interface: `ClusterMessage`
    Returns the unique identifier for this message.
    Returns:
      the unique ID

  - ### getFileName

    public String getFileName()
    Returns the name of the file being transferred.
    Returns:
      The file name

  - ### getContextName

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