1 | \section{\module{binhex} ---
|
---|
2 | Encode and decode binhex4 files}
|
---|
3 |
|
---|
4 | \declaremodule{standard}{binhex}
|
---|
5 | \modulesynopsis{Encode and decode files in binhex4 format.}
|
---|
6 |
|
---|
7 |
|
---|
8 | This module encodes and decodes files in binhex4 format, a format
|
---|
9 | allowing representation of Macintosh files in \ASCII. On the Macintosh,
|
---|
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 |
|
---|
13 | The \module{binhex} module defines the following functions:
|
---|
14 |
|
---|
15 | \begin{funcdesc}{binhex}{input, output}
|
---|
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
|
---|
18 | file-like object (any object supporting a \method{write()} and
|
---|
19 | \method{close()} method).
|
---|
20 | \end{funcdesc}
|
---|
21 |
|
---|
22 | \begin{funcdesc}{hexbin}{input\optional{, output}}
|
---|
23 | Decode a binhex file \var{input}. \var{input} may be a filename or a
|
---|
24 | file-like object supporting \method{read()} and \method{close()} methods.
|
---|
25 | The resulting file is written to a file named \var{output}, unless the
|
---|
26 | argument is omitted in which case the output filename is read from the
|
---|
27 | binhex file.
|
---|
28 | \end{funcdesc}
|
---|
29 |
|
---|
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 |
|
---|
38 |
|
---|
39 | \begin{seealso}
|
---|
40 | \seemodule{binascii}{Support module containing \ASCII-to-binary
|
---|
41 | and binary-to-\ASCII{} conversions.}
|
---|
42 | \end{seealso}
|
---|
43 |
|
---|
44 |
|
---|
45 | \subsection{Notes \label{binhex-notes}}
|
---|
46 |
|
---|
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
|
---|
51 | still use the Macintosh newline convention (carriage-return as end of
|
---|
52 | line).
|
---|
53 |
|
---|
54 | As of this writing, \function{hexbin()} appears to not work in all
|
---|
55 | cases.
|
---|