App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | List of all members
google.appengine.api.files.file._File Class Reference
Inheritance diagram for google.appengine.api.files.file._File:

Public Member Functions

def __init__
 
def close
 
def __enter__
 
def __exit__
 
def write
 
def tell
 
def seek
 
def read
 
def stat
 

Detailed Description

File object.

File object must be obtained by open() function and closed by its close()
method. It supports scoped closing by with operator.

Constructor & Destructor Documentation

def google.appengine.api.files.file._File.__init__ (   self,
  filename,
  mode,
  content_type,
  exclusive_lock 
)
Constructor.

Args:
  filename: File's name as string.
  content_type: File's content type. Value from FileContentType.ContentType
enum.

Member Function Documentation

def google.appengine.api.files.file._File.close (   self,
  finalize = False 
)
Close file.

Args:
  finalize: Specifies if file should be finalized upon closing.
def google.appengine.api.files.file._File.read (   self,
  size = None 
)
Read data from RAW file.

Args:
  size: Number of bytes to read as integer. Actual number of bytes
read might be less than specified, but it's never 0 unless current
offset is at the end of the file. If it is None, then file is read
until the end.

Returns:
  A string with data read.
def google.appengine.api.files.file._File.seek (   self,
  offset,
  whence = os.SEEK_SET 
)
Set the file's current position.

Args:
  offset: seek offset as number.
  whence: seek mode. Supported modes are os.SEEK_SET (absolute seek),
and os.SEEK_CUR (seek relative to the current position) and os.SEEK_END
(seek relative to the end, offset should be negative).
def google.appengine.api.files.file._File.stat (   self)
Get status of a finalized file.

Returns:
  a _FileStat object similar to that returned by python's os.stat(path).

Throws:
  FinalizationError if file is not finalized.
def google.appengine.api.files.file._File.tell (   self)
Return file's current position.

Is valid only when file is opened for read.
def google.appengine.api.files.file._File.write (   self,
  data,
  sequence_key = None 
)
Write data to file.

Args:
  data: Data to be written to the file. For RAW files it should be a string
or byte sequence.
  sequence_key: Sequence key to use for write. Is used for RAW files only.
File API infrastructure ensures that sequence_key are monotonically
increasing. If sequence key less than previous one is used, a
SequenceKeyOutOfOrderError exception with last recorded sequence key
will be raised. If part of already written content is lost due to
infrastructure failure, last_sequence_key will point to last
successfully written key.

Raises:
  SequenceKeyOutOfOrderError: Raised when passed sequence keys are not
monotonically increasing.
  InvalidArgumentError: Raised when wrong object type is apssed in as data.
  Error: Error or its descendants are raised when other error has happened.

The documentation for this class was generated from the following file: