|
int | SEEK_SET = 0 |
|
int | SEEK_CUR = 1 |
|
int | SEEK_END = 2 |
|
Provides a read-only file-like interface to a blobstore blob.
def google.appengine.ext.blobstore.blobstore.BlobReader.__init__ |
( |
|
self, |
|
|
|
blob, |
|
|
|
buffer_size = 131072 , |
|
|
|
position = 0 |
|
) |
| |
Constructor.
Args:
blob: The blob key, blob info, or string blob key to read from.
buffer_size: The minimum size to fetch chunks of data from blobstore.
position: The initial position in the file.
Raises:
ValueError if a blob key, blob info or string blob key is not supplied.
def google.appengine.ext.blobstore.blobstore.BlobReader.__getstate__ |
( |
|
self | ) |
|
Returns the serialized state for this BlobReader.
def google.appengine.ext.blobstore.blobstore.BlobReader.__iter__ |
( |
|
self | ) |
|
Returns a file iterator for this BlobReader.
def google.appengine.ext.blobstore.blobstore.BlobReader.__setstate__ |
( |
|
self, |
|
|
|
state |
|
) |
| |
Restores pickled state for this BlobReader.
def google.appengine.ext.blobstore.blobstore.BlobReader.blob_info |
( |
|
self | ) |
|
Returns the BlobInfo for this file.
def google.appengine.ext.blobstore.blobstore.BlobReader.close |
( |
|
self | ) |
|
Close the file.
A closed file cannot be read or written any more. Any operation which
requires that the file be open will raise a ValueError after the file has
been closed. Calling close() more than once is allowed.
def google.appengine.ext.blobstore.blobstore.BlobReader.closed |
( |
|
self | ) |
|
Returns True if this file is closed, False otherwise.
def google.appengine.ext.blobstore.blobstore.BlobReader.next |
( |
|
self | ) |
|
Returns the next line from the file.
Returns:
A string, terminted by \n. The last line may not be terminated by \n.
If EOF is reached, an empty string will be returned.
def google.appengine.ext.blobstore.blobstore.BlobReader.read |
( |
|
self, |
|
|
|
size = -1 |
|
) |
| |
Read at most size bytes from the file.
Fewer bytes are read if the read hits EOF before obtaining size bytes.
If the size argument is negative or omitted, read all data until EOF is
reached. The bytes are returned as a string object. An empty string is
returned when EOF is encountered immediately.
Calling read() without a size specified is likely to be dangerous, as it
may read excessive amounts of data.
Args:
size: Optional. The maximum number of bytes to read. When omitted, read()
returns all remaining data in the file.
Returns:
The read data, as a string.
def google.appengine.ext.blobstore.blobstore.BlobReader.readline |
( |
|
self, |
|
|
|
size = -1 |
|
) |
| |
Read one entire line from the file.
A trailing newline character is kept in the string (but may be absent when a
file ends with an incomplete line). If the size argument is present and
non-negative, it is a maximum byte count (including the trailing newline)
and an incomplete line may be returned. An empty string is returned only
when EOF is encountered immediately.
Args:
size: Optional. The maximum number of bytes to read.
Returns:
The read data, as a string.
def google.appengine.ext.blobstore.blobstore.BlobReader.readlines |
( |
|
self, |
|
|
|
sizehint = None |
|
) |
| |
Read until EOF using readline() and return a list of lines thus read.
If the optional sizehint argument is present, instead of reading up to EOF,
whole lines totalling approximately sizehint bytes (possibly after rounding
up to an internal buffer size) are read.
Args:
sizehint: A hint as to the maximum number of bytes to read.
Returns:
A list of strings, each being a single line from the file.
def google.appengine.ext.blobstore.blobstore.BlobReader.seek |
( |
|
self, |
|
|
|
offset, |
|
|
|
whence = SEEK_SET |
|
) |
| |
Set the file's current position, like stdio's fseek().
The whence argument is optional and defaults to os.SEEK_SET or 0 (absolute
file positioning); other values are os.SEEK_CUR or 1 (seek relative to the
current position) and os.SEEK_END or 2 (seek relative to the file's end).
Args:
offset: The relative offset to seek to.
whence: Defines what the offset is relative to. See description for
details.
def google.appengine.ext.blobstore.blobstore.BlobReader.tell |
( |
|
self | ) |
|
Return the file's current position, like stdio's ftell().
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/google/appengine/ext/blobstore/blobstore.py