Class FileTransfer
java.lang.Object
ch.autumo.beetroot.server.communication.FileTransfer
- Direct Known Subclasses:
ClientFileTransfer
Client/Server file transfer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static intbuffer length for sending bits of a filestatic final StringFile getstatic intdefault buffer length in Kb for sending bits of a filestatic intfile receiver default portstatic intfile server default portprotected static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilereadFile(DataInputStream in, String fileName, long size) Server/client side file read.static voidwriteFile(Download download, DataOutputStream output) Write/send file from server to client.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG -
DEFAULT_FILE_SERVER_PORT
public static int DEFAULT_FILE_SERVER_PORTfile server default port -
DEFAULT_FILE_RECEIVER_PORT
public static int DEFAULT_FILE_RECEIVER_PORTfile receiver default port -
CMD_FILE_GET
File get- See Also:
-
DEFAULT_BUFFER_LEN
public static int DEFAULT_BUFFER_LENdefault buffer length in Kb for sending bits of a file -
bufferLen
protected static int bufferLenbuffer length for sending bits of a file
-
-
Constructor Details
-
FileTransfer
public FileTransfer()
-
-
Method Details
-
writeFile
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 fileoutput- output stream- Throws:
IOException- IO exception
-
readFile
Server/client side file read.- Parameters:
in- input streamfileName- file namesize- file size previously read!- Returns:
- server temporary file or null, if file received was invalid
- Throws:
IOException- IO exception
-