Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{binhex} --- |
Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 2 | Encode and decode binhex4 files} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 3 | |
Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{binhex} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 5 | \modulesynopsis{Encode and decode files in binhex4 format.} |
| 6 | |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 7 | |
| 8 | This module encodes and decodes files in binhex4 format, a format |
Fred Drake | c37b65e | 2001-11-28 07:26:15 +0000 | [diff] [blame] | 9 | allowing representation of Macintosh files in \ASCII. On the Macintosh, |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 10 | both forks of a file and the finder information are encoded (or |
| 11 | decoded), on other platforms only the data fork is handled. |
| 12 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 13 | The \module{binhex} module defines the following functions: |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 14 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 15 | \begin{funcdesc}{binhex}{input, output} |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 16 | Convert a binary file with filename \var{input} to binhex file |
| 17 | \var{output}. The \var{output} parameter can either be a filename or a |
Fred Drake | 26f7cfe9 | 1999-04-23 15:41:53 +0000 | [diff] [blame] | 18 | file-like object (any object supporting a \method{write()} and |
| 19 | \method{close()} method). |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 20 | \end{funcdesc} |
| 21 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 22 | \begin{funcdesc}{hexbin}{input\optional{, output}} |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 23 | Decode a binhex file \var{input}. \var{input} may be a filename or a |
Fred Drake | 26f7cfe9 | 1999-04-23 15:41:53 +0000 | [diff] [blame] | 24 | file-like object supporting \method{read()} and \method{close()} methods. |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 25 | The resulting file is written to a file named \var{output}, unless the |
Fred Drake | 26f7cfe9 | 1999-04-23 15:41:53 +0000 | [diff] [blame] | 26 | argument is omitted in which case the output filename is read from the |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 27 | binhex file. |
| 28 | \end{funcdesc} |
| 29 | |
Fred Drake | 3787c9d | 2002-03-25 16:37:56 +0000 | [diff] [blame] | 30 | The following exception is also defined: |
| 31 | |
| 32 | \begin{excdesc}{Error} |
| 33 | Exception raised when something can't be encoded using the binhex |
| 34 | format (for example, a filename is too long to fit in the filename |
| 35 | field), or when input is not properly encoded binhex data. |
| 36 | \end{excdesc} |
| 37 | |
Fred Drake | 26f7cfe9 | 1999-04-23 15:41:53 +0000 | [diff] [blame] | 38 | |
| 39 | \begin{seealso} |
Fred Drake | ba0a989 | 2000-10-18 17:43:06 +0000 | [diff] [blame] | 40 | \seemodule{binascii}{Support module containing \ASCII-to-binary |
| 41 | and binary-to-\ASCII{} conversions.} |
Fred Drake | 26f7cfe9 | 1999-04-23 15:41:53 +0000 | [diff] [blame] | 42 | \end{seealso} |
| 43 | |
| 44 | |
Fred Drake | bbac432 | 1999-02-20 00:14:17 +0000 | [diff] [blame] | 45 | \subsection{Notes \label{binhex-notes}} |
| 46 | |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 47 | There is an alternative, more powerful interface to the coder and |
| 48 | decoder, see the source for details. |
| 49 | |
| 50 | If you code or decode textfiles on non-Macintosh platforms they will |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 51 | still use the Macintosh newline convention (carriage-return as end of |
Fred Drake | 1aabe5e | 1998-02-19 18:29:18 +0000 | [diff] [blame] | 52 | line). |
| 53 | |
Fred Drake | fc57619 | 1998-04-04 07:15:02 +0000 | [diff] [blame] | 54 | As of this writing, \function{hexbin()} appears to not work in all |
| 55 | cases. |