and data can be transferred in two different modes with all client
classes - binary mode and ASCII mode. The transfer mode should always be
set explicitly to ensure the correct mode is used.
ASCII mode should be used when
end-of-line character translation is required. When using ASCII mode,
files are not
transferred byte-for-byte. Instead, the newline
character(s) on the source platform (e.g. in Windows, CR+LF) are
replaced with the newline character(s) on the target platform (e.g. on
Unix, LF). This means the source file may not be the same size as the
end result if the platforms differ. If binary mode is used, for
example, to transfer Unix text files to a Windows platform, many
Windows text editors will not recognize the Unix newline characters,
and the file will be difficult to read. To use ASCII mode, the setType()
method should be used, supplying the ASCII type as shown.
mode is the default for the majority of FTP servers and is therefore
also the default in edtFTPj/PRO.
It's important to note that it is often acceptable to transfer text
files in binary mode since most modern text editors are able to deal
with UNIX and Windows end-of-line characters interchangably.
Furthermore, text files that appear to be ASCII files often
contain "extended ASCII" characters which may be incompatible between
different platforms. It is therefore advisable to use binary
unless end-of-line character translation is definitely required.
Binary mode (a.k.a. image mode)
should be used whenever no end-of-line translation is required.
binary mode, the file is transferred byte-for-byte, i.e. an exact copy
of the file or data is transferred. Typically, binary mode is used for
files such as executables, compressed files, media files and non-text
document formats such as OpenOffice or Microsoft Office files. To use
binary mode, the setType()
method should be used, supplying the BINARY type as shown.