public final class SerialComXModemCRC extends Object
Implements state machine for XMODEM-CRC file transfer protocol in Java. Addition of CRC increases data integrity.
| Constructor and Description |
|---|
SerialComXModemCRC(SerialComManager scm,
long handle,
File fileToProcess,
boolean textMode,
ISerialComXmodemProgress progressListener,
SerialComXModemAbort transferState,
int osType)
Allocates a new SerialComXModemCRC object with given details and associate it with the given
instance of SerialComManager class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
receiveFileX()
Represents actions to execute in state machine to implement
xmodem-crc protocol for receiving files.
|
boolean |
sendFileX()
Represents actions to execute in state machine to implement xmodem/crc protocol
for sending files.
|
public SerialComXModemCRC(SerialComManager scm, long handle, File fileToProcess, boolean textMode, ISerialComXmodemProgress progressListener, SerialComXModemAbort transferState, int osType)
Allocates a new SerialComXModemCRC object with given details and associate it with the given instance of SerialComManager class.
scm - SerialComManager instance associated with this handle.handle - of the port on which file is to be communicated.fileToProcess - File instance representing file to be communicated.textMode - if true file will be sent as text file (ASCII mode), if false file will be sent
as binary file.progressListener - object of class which implements ISerialComXmodemProgress interface and is
interested in knowing
how many blocks have been sent/received till now.transferState - if application wish to abort sending/receiving file at instant of time due to any
reason, it can call abortTransfer method on this object. It can be null of application does not
wish to abort sending/receiving file explicitly.osType - operating system on which this application is running.public boolean sendFileX()
throws SecurityException,
IOException,
SerialComException
Represents actions to execute in state machine to implement xmodem/crc protocol for sending files.
SecurityException - if unable to read from file to be sent.IOException - if any I/O error occurs.SerialComException - if any I/0 error on serial port communication occurs.public boolean receiveFileX()
throws IOException,
SerialComException
Represents actions to execute in state machine to implement xmodem-crc protocol for receiving files.
IOException - if any I/O error occurs.SerialComException - if any I/0 error on serial port communication occurs.Copyright © 2016. All rights reserved.