Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
97793ab6
Commit
97793ab6
authored
Jun 22, 1999
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New section from Moshe Zadka, modified by FLD for markup, some
additional content.
parent
d58c7464
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
Doc/lib/libchunk.tex
Doc/lib/libchunk.tex
+71
-0
No files found.
Doc/lib/libchunk.tex
0 → 100644
View file @
97793ab6
\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}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment