public class XYModem extends Object
Supports XModem-Checksum, XModem-CRC, XModem-1k, YModem-Batch, YModem-G.
Implements just enough of ZModem to support AutoDownload, relying on
automatic sender fallback to X/YModem, if available.
Based on X/YMODEM Protocol Reference, June 18 1988:
http://pauillac.inria.fr/~doligez/zmodem/ymodem.txt
ZModem AutoDownload support from
The ZMODEM Inter Application File Transfer Protocol, Oct-14-88
http://gallium.inria.fr/~doligez/zmodem/zmodem.txt
with values defined from
http://read.pudn.com/downloads/sourcecode/comm/984/ZMODEM.H__.htm
| Modifier and Type | Class and Description |
|---|---|
static class |
XYModem.OverrunOption
Behavior options for data received past the end of a downloaded file, when file length
is provided by sender in YModem protocol.
|
| Constructor and Description |
|---|
XYModem(IOHandler ioHandler)
Create new instance of XYModem.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
autoDownloadDetect(char ch)
Examines sequence of characters for the ZModem ZRQINIT frame requesting
start of download, and indicates whether it is seen.
|
void |
download()
Begin download of file(s).
|
static String |
formatBPS(long bytes,
Duration elapsed)
Format the given number of bytes per second in friendly Bps, KBps, MBps, GBps, TBps format.
|
static String |
formatBytes(long bytes)
Format the given number of bytes in friendly B, KB, MB, GB, TB format.
|
static String |
formatElapsedTime(Duration elapsed)
Return the given duration in the format HH:MM:SS.
|
void |
setOverrunOption(XYModem.OverrunOption option) |
public XYModem(IOHandler ioHandler)
ioHandler - IOHandler instance to use.public void setOverrunOption(XYModem.OverrunOption option)
public boolean autoDownloadDetect(char ch)
ch - Next character in the sequence.public void download()
public static String formatElapsedTime(Duration elapsed)
elapsed - Duration to format.public static String formatBPS(long bytes, Duration elapsed)
bytes - Number of bytes.elapsed - Number of seconds elapsed.public static String formatBytes(long bytes)
bytes - Number of bytes to format.Copyright © 2019. All rights reserved.