Package com.io7m.cardant.client.basic.internal

# Interface CAHandlerType

All Superinterfaces:
  `com.io7m.hibiscus.basic.HBClientHandlerType<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>`

All Known Implementing Classes:
  `CAHandler1`, `CAHandlerAbstract`, `CAHandlerDisconnected`

public interface CAHandlerType extends com.io7m.hibiscus.basic.HBClientHandlerType<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>
A versioned protocol handler.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.io7m.hibiscus.api.HBResultType<Path,CAIResponseError>`
  `onExecuteFileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics)`
  Download the data associated with the given file.
  `com.io7m.hibiscus.api.HBResultType<CAFileID,CAIResponseError>`
  `onExecuteFileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics)`
  Upload the data associated with the given file.
  `com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError>`
  `onExecuteGarbage()`
  Send garbage to the server.
  `com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError>`
  `onExecuteInvalid()`
  Send a well-formed but invalid command to the server.

  ### Methods inherited from interface com.io7m.hibiscus.basic.HBClientHandlerType

  `onDisconnect, onExecuteCommand, onExecuteLogin, onIsConnected, onPollEvents`

- ## Method Details

  - ### onExecuteFileDownload

    com.io7m.hibiscus.api.HBResultType<Path,CAIResponseError> onExecuteFileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException
    Download the data associated with the given file. The file will be downloaded to a temporary file and then, if everything succeeds and the hash value matches, the temporary file will atomically replace the output file.
    Parameters:
      `fileID` - The file ID
      `file` - The output file
      `fileTmp` - The temporary output file
      `size` - The expected size
      `hashAlgorithm` - The hash algorithm
      `hashValue` - The expected hash value
      `statistics` - A receiver of transfer statistics
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### onExecuteFileUpload

    com.io7m.hibiscus.api.HBResultType<CAFileID,CAIResponseError> onExecuteFileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException
    Upload the data associated with the given file.
    Parameters:
      `fileID` - The file ID
      `file` - The input file
      `contentType` - The content type
      `description` - The file description
      `statistics` - A receiver of transfer statistics
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### onExecuteGarbage

    com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> onExecuteGarbage() throws InterruptedException
    Send garbage to the server.
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### onExecuteInvalid

    com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> onExecuteInvalid() throws InterruptedException
    Send a well-formed but invalid command to the server.
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption