Class FileTransfer

java.lang.Object
ch.autumo.beetroot.server.communication.FileTransfer
Direct Known Subclasses:
ClientFileTransfer

public class FileTransfer extends Object
Client/Server file transfer.
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
    • DEFAULT_FILE_SERVER_PORT

      public static int DEFAULT_FILE_SERVER_PORT
      file server default port
    • DEFAULT_FILE_RECEIVER_PORT

      public static int DEFAULT_FILE_RECEIVER_PORT
      file receiver default port
    • CMD_FILE_GET

      public static final String CMD_FILE_GET
      File get
      See Also:
    • DEFAULT_BUFFER_LEN

      public static int DEFAULT_BUFFER_LEN
      default buffer length in Kb for sending bits of a file
    • bufferLen

      protected static int bufferLen
      buffer length for sending bits of a file
  • Constructor Details

    • FileTransfer

      public FileTransfer()
  • Method Details

    • writeFile

      public static void writeFile(Download download, DataOutputStream output) throws IOException
      Write/send file from server to client. NOTE: The file referenced by the download will be deleted after sending it to the client; only provide temporary files (copy of the originals) within the download!
      Parameters:
      download - download file
      output - output stream
      Throws:
      IOException - IO exception
    • readFile

      public static File readFile(DataInputStream in, String fileName, long size) throws IOException
      Server/client side file read.
      Parameters:
      in - input stream
      fileName - file name
      size - file size previously read!
      Returns:
      server temporary file or null, if file received was invalid
      Throws:
      IOException - IO exception