diff options
Diffstat (limited to 'Doc/library/chunk.rst')
-rw-r--r-- | Doc/library/chunk.rst | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/Doc/library/chunk.rst b/Doc/library/chunk.rst index 2e1798d..64ce4e2 100644 --- a/Doc/library/chunk.rst +++ b/Doc/library/chunk.rst @@ -66,62 +66,64 @@ instance will fail with a :exc:`EOFError` exception. optional argument *inclheader* is true, the size given in the chunk header includes the size of the header. The default value is false. -A :class:`Chunk` object supports the following methods: + A :class:`Chunk` object supports the following methods: -.. method:: Chunk.getname() + .. method:: getname() - Returns the name (ID) of the chunk. This is the first 4 bytes of the chunk. + Returns the name (ID) of the chunk. This is the first 4 bytes of the + chunk. -.. method:: Chunk.getsize() + .. method:: getsize() - Returns the size of the chunk. + Returns the size of the chunk. -.. method:: Chunk.close() + .. method:: close() - Close and skip to the end of the chunk. This does not close the underlying - file. + Close and skip to the end of the chunk. This does not close the + underlying file. -The remaining methods will raise :exc:`IOError` if called after the -:meth:`close` method has been called. + The remaining methods will raise :exc:`IOError` if called after the + :meth:`close` method has been called. -.. method:: Chunk.isatty() + .. method:: isatty() - Returns ``False``. + Returns ``False``. -.. method:: Chunk.seek(pos[, whence]) + .. method:: seek(pos[, whence]) - Set the chunk's current position. The *whence* argument is optional and - defaults to ``0`` (absolute file positioning); other values are ``1`` (seek - relative to the current position) and ``2`` (seek relative to the file's end). - There is no return value. If the underlying file does not allow seek, only - forward seeks are allowed. + Set the chunk's current position. The *whence* argument is optional and + defaults to ``0`` (absolute file positioning); other values are ``1`` + (seek relative to the current position) and ``2`` (seek relative to the + file's end). There is no return value. If the underlying file does not + allow seek, only forward seeks are allowed. -.. method:: Chunk.tell() + .. method:: tell() - Return the current position into the chunk. + Return the current position into the chunk. -.. method:: Chunk.read([size]) + .. method:: read([size]) - Read at most *size* bytes from the chunk (less if the read hits the end of the - chunk before obtaining *size* bytes). If the *size* argument is negative or - omitted, read all data until the end of the chunk. The bytes are returned as a - string object. An empty string is returned when the end of the chunk is - encountered immediately. + Read at most *size* bytes from the chunk (less if the read hits the end of + the chunk before obtaining *size* bytes). If the *size* argument is + negative or omitted, read all data until the end of the chunk. The bytes + are returned as a string object. An empty string is returned when the end + of the chunk is encountered immediately. -.. method:: Chunk.skip() + .. method:: skip() + + Skip to the end of the chunk. All further calls to :meth:`read` for the + chunk will return ``''``. 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. - Skip to the end of the chunk. All further calls to :meth:`read` for the chunk - will return ``''``. 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. .. rubric:: Footnotes |