public final class SerialComYModemG extends Object
Implements YMODEM-G file transfer protocol state machine in Java.
This protocol does not provide software error correction or recovery, but expects the modem to provide the service. It is a streaming protocol that sends and receives 1K packets in a continuous stream until instructed to stop. It does not wait for positive acknowledgement after each block is sent, but rather sends blocks in rapid succession. If any block is unsuccessfully transferred, the entire transfer is canceled.
| Constructor and Description |
|---|
SerialComYModemG(SerialComManager scm,
long handle,
File[] filesToSend,
boolean textMode,
ISerialComYmodemProgress progressListener,
SerialComFTPCMDAbort transferState,
int osType)
Allocates a new SerialComYModemG object with given details and associate it with the given
instance of SerialComManager class.
|
SerialComYModemG(SerialComManager scm,
long handle,
File filesToReceive,
boolean textMode,
ISerialComYmodemProgress progressListener,
SerialComFTPCMDAbort transferState,
int osType)
Allocates a new SerialComYModemG object with given details and associate it with the given
instance of SerialComManager class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
receiveFileY()
Represents actions to execute in state machine to implement ymodem-g protocol for
receiving files.
|
boolean |
sendFileY()
Represents actions to execute in state machine to implement ymodem-g protocol
for sending files.
|
public SerialComYModemG(SerialComManager scm, long handle, File[] filesToSend, boolean textMode, ISerialComYmodemProgress progressListener, SerialComFTPCMDAbort transferState, int osType)
Allocates a new SerialComYModemG object with given details and associate it with the given instance of SerialComManager class. This is used for sending files.
scm - SerialComManager instance associated with this handle.handle - of the port on which file is to be communicated.filesToSend - all the files to be sent to the receiver end.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 ISerialComYmodemProgress 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 if application
does not wish to abort sending/receiving file explicitly.osType - operating system on which this application is running.public SerialComYModemG(SerialComManager scm, long handle, File filesToReceive, boolean textMode, ISerialComYmodemProgress progressListener, SerialComFTPCMDAbort transferState, int osType)
Allocates a new SerialComYModemG object with given details and associate it with the given instance of SerialComManager class. This is used for receiving files.
scm - SerialComManager instance associated with this handle.handle - of the port on which file is to be communicated.filesToReceive - folder in which all files received will be placed.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 ISerialComYmodemProgress 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 if application
does not wish to abort sending/receiving file explicitly.osType - operating system on which this application is running.public boolean receiveFileY()
throws IOException
Represents actions to execute in state machine to implement ymodem-g protocol for receiving files.
IOException - if any I/O error occurs.com.serialpundit.core.SerialComException - if any I/0 error occurs or operation is aborted.public boolean sendFileY()
throws IOException
Represents actions to execute in state machine to implement ymodem-g protocol for sending files.
SecurityException - if unable to read from file to be sent.IOException - if any I/O error occurs.com.serialpundit.core.SerialComException - if any I/0 error on serial port communication occurs.Copyright © 2017. All rights reserved.