/Doc/library/binhex.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 63 lines · 36 code · 27 blank · 0 comment · 0 complexity · a126a15ab4d9e1360016e4cb7dfdb25a MD5 · raw file

  1. :mod:`binhex` --- Encode and decode binhex4 files
  2. =================================================
  3. .. module:: binhex
  4. :synopsis: Encode and decode files in binhex4 format.
  5. This module encodes and decodes files in binhex4 format, a format allowing
  6. representation of Macintosh files in ASCII. On the Macintosh, both forks of a
  7. file and the finder information are encoded (or decoded), on other platforms
  8. only the data fork is handled.
  9. .. note::
  10. In Python 3.x, special Macintosh support has been removed.
  11. The :mod:`binhex` module defines the following functions:
  12. .. function:: binhex(input, output)
  13. Convert a binary file with filename *input* to binhex file *output*. The
  14. *output* parameter can either be a filename or a file-like object (any object
  15. supporting a :meth:`write` and :meth:`close` method).
  16. .. function:: hexbin(input[, output])
  17. Decode a binhex file *input*. *input* may be a filename or a file-like object
  18. supporting :meth:`read` and :meth:`close` methods. The resulting file is written
  19. to a file named *output*, unless the argument is omitted in which case the
  20. output filename is read from the binhex file.
  21. The following exception is also defined:
  22. .. exception:: Error
  23. Exception raised when something can't be encoded using the binhex format (for
  24. example, a filename is too long to fit in the filename field), or when input is
  25. not properly encoded binhex data.
  26. .. seealso::
  27. Module :mod:`binascii`
  28. Support module containing ASCII-to-binary and binary-to-ASCII conversions.
  29. .. _binhex-notes:
  30. Notes
  31. -----
  32. There is an alternative, more powerful interface to the coder and decoder, see
  33. the source for details.
  34. If you code or decode textfiles on non-Macintosh platforms they will still use
  35. the old Macintosh newline convention (carriage-return as end of line).
  36. As of this writing, :func:`hexbin` appears to not work in all cases.