Class FileDataMessage

java.lang.Object
org.kendar.sync.lib.protocol.Message
org.kendar.sync.lib.protocol.FileDataMessage

public class FileDataMessage extends Message
Message containing a chunk of file data.
  • Constructor Details

    • FileDataMessage

      public FileDataMessage()
    • FileDataMessage

      public FileDataMessage(String relativePath, int blockNumber, int totalBlocks, byte[] data)
      Creates a new file data message.
      Parameters:
      relativePath - The relative path of the file
      blockNumber - The block number (0-based)
      totalBlocks - The total number of blocks
      data - The file data
  • Method Details

    • getMessageType

      public MessageType getMessageType()
      Description copied from class: Message
      Gets the message type for this message.
      Specified by:
      getMessageType in class Message
      Returns:
      The message type
    • deserialize

      protected Message deserialize(ByteContainer buffer)
      Specified by:
      deserialize in class Message
    • serialize

      protected void serialize(ByteContainer buffer)
      Specified by:
      serialize in class Message
    • getRelativePath

      public String getRelativePath()
    • setRelativePath

      public void setRelativePath(String relativePath)
    • getBlockNumber

      public int getBlockNumber()
    • setBlockNumber

      public void setBlockNumber(int blockNumber)
    • getTotalBlocks

      public int getTotalBlocks()
    • setTotalBlocks

      public void setTotalBlocks(int totalBlocks)
    • getData

      public byte[] getData()
    • setData

      public void setData(byte[] data)
    • isFirstBlock

      public boolean isFirstBlock()
      Checks if this is the first block of the file.
      Returns:
      True if this is the first block, false otherwise
    • isLastBlock

      public boolean isLastBlock()
      Checks if this is the last block of the file.
      Returns:
      True if this is the last block, false otherwise