diff options
author | Fred Drake <fdrake@acm.org> | 1999-06-22 18:49:20 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-06-22 18:49:20 (GMT) |
commit | 97793ab6b9343a4a0c5ef219902b2a3f0576ef90 (patch) | |
tree | 436525ad7e6c7e24c8043b2bc637504360989a65 /Doc | |
parent | d58c7464d96e212c2d0b458b9509a328a68f1961 (diff) | |
download | cpython-97793ab6b9343a4a0c5ef219902b2a3f0576ef90.zip cpython-97793ab6b9343a4a0c5ef219902b2a3f0576ef90.tar.gz cpython-97793ab6b9343a4a0c5ef219902b2a3f0576ef90.tar.bz2 |
New section from Moshe Zadka, modified by FLD for markup, some
additional content.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libchunk.tex | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/Doc/lib/libchunk.tex b/Doc/lib/libchunk.tex new file mode 100644 index 0000000..ceaf309 --- /dev/null +++ b/Doc/lib/libchunk.tex @@ -0,0 +1,71 @@ +\section{\module{chunk} --- + Helper for reading IFF chunks} + +\declaremodule{standard}{chunk} +\sectionauthor{Moshe Zadka}{mzadka@geocities.com} +\modulesynopsis{Helper class for reading from IFF-based file formats.} + +The \module{chunk} module defines a class for interfacing to ``IFF'' +chunk-based files, like TIFF or AIFF. This is used as a helper module +for the \refmodule{aifc} and \refmodule{wave} modules. + +The \module{chunk} module defines the following class: + +\begin{classdesc}{Chunk}{file\optional{, align}} +The chunk from \var{file} starting at \var{file}'s current +position. The \var{align} argument, which defaults to true, determines +whether to align chunk data on 2-byte boundaries. + +\exception{EOFError} is raised if \var{file} does not contain enough +data to read the IFF header. +\end{classdesc} + +The IFF header format is described in this table: + +\begin{tableiii}{c|c|l}{textrm}{Offset}{Length}{Contents} + \lineiii{0}{4}{Chunk ID} + \lineiii{4}{4}{Size of chunk in big-endian byte order, including the + header} +\end{tableiii} + + +\subsection{Chunk Objects \label{iff-chunk-objects}} + +Chunk objects have the following methods: + +\begin{methoddesc}{getname}{} +Return the ID of the chunk. +\end{methoddesc} + +\begin{methoddesc}{close}{} +Close the chunk, forwarding the file pointer to the end of the chunk. +\end{methoddesc} + +\begin{methoddesc}{isatty}{} +Returns false unless the chunk has been closed, in which case +\exception{ValueError} is raised. +\end{methoddesc} + +\begin{methoddesc}{seek}{offset\optional{, whence}} +Seek to a position within the chunk. If file pointer is not seekable, +or \var{offset} would point outside the chunk, an error is raised. +\var{whence} is interpreted the same as for the \method{seek()} method +on file objects; see section \ref{bltin-file-objects} for more +information. +\end{methoddesc} + +\begin{methoddesc}{tell}{} +Return the current position within this chunk. +\end{methoddesc} + +\begin{methoddesc}{read}{\optional{n}} +Read at most \var{n} bytes from the chunk. If \var{n} is omitted +or negative, read until the end of the chunk. +\end{methoddesc} + +\begin{methoddesc}{skip}{} +Skip to the end of the chunk. All further calls to \method{read()} +for the chunk will return \code{''}. If you are not interested in the +contents of the chunk, this method should be called so that the file +points to the start of the next chunk. +\end{methoddesc} |