Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions
xpcom.file._File Class Reference
Inheritance diagram for xpcom.file._File:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __del__
def read
def readlines
def write
def close
def flush

Public Attributes

 lockob
 inputStream
 outputStream
 channel

Private Member Functions

def _lock
def _release

Detailed Description

Definition at line 94 of file file.py.


Constructor & Destructor Documentation

def xpcom.file._File.__init__ (   self,
  name_thingy = None,
  mode = "r" 
)

Definition at line 95 of file file.py.

00095 
00096     def __init__(self, name_thingy = None, mode="r"):
00097         self.lockob = threading.Lock()
00098         self.inputStream = self.outputStream = None
00099         if name_thingy is not None:
00100                 self.init(name_thingy, mode)

def xpcom.file._File.__del__ (   self)

Definition at line 101 of file file.py.

00101 
00102     def __del__(self):
00103         self.close()

Here is the call graph for this function:


Member Function Documentation

def xpcom.file._File._lock (   self) [private]

Definition at line 105 of file file.py.

00105 
00106     def _lock(self):
        self.lockob.acquire()

Here is the caller graph for this function:

def xpcom.file._File._release (   self) [private]

Definition at line 107 of file file.py.

00107 
00108     def _release(self):
        self.lockob.release()

Here is the caller graph for this function:

def xpcom.file._File.close (   self)

Reimplemented in xpcom.file.LocalFile.

Definition at line 133 of file file.py.

00133 
00134     def close(self):
00135         self._lock()
00136         try:
00137             if self.inputStream is not None:
00138                 self.inputStream.close()
00139                 self.inputStream = None
00140             if self.outputStream is not None:
00141                 self.outputStream.close()
00142                 self.outputStream = None
00143             self.channel = None
00144         finally:
00145             self._release()

Here is the call graph for this function:

Here is the caller graph for this function:

def xpcom.file._File.flush (   self)

Definition at line 146 of file file.py.

00146 
00147     def flush(self):
00148         self._lock()
00149         try:
00150             if self.outputStream is not None: self.outputStream.flush()
00151         finally:
00152             self._release()
00153 
# A synchronous "file object" used to open a URI.

Here is the call graph for this function:

def xpcom.file._File.read (   self,
  n = -1 
)

Reimplemented in xpcom.file.LocalFile.

Definition at line 109 of file file.py.

00109 
00110     def read(self, n = -1):
00111         assert self.inputStream is not None, "Not setup for read!"
00112         self._lock()
00113         try:
00114             return str(self.inputStream.read(n))
00115         finally:
00116             self._release()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 117 of file file.py.

00117 
00118     def readlines(self):
00119         # Not part of the xpcom interface, but handy for direct Python users.
00120         # Not 100% faithful, but near enough for now!
00121         lines = self.read().split("\n")
00122         if len(lines) and len(lines[-1]) == 0:
00123             lines = lines[:-1]
00124         return [s+"\n" for s in lines ]

Here is the call graph for this function:

def xpcom.file._File.write (   self,
  data 
)

Definition at line 125 of file file.py.

00125 
00126     def write(self, data):
00127         assert self.outputStream is not None, "Not setup for write!"
00128         self._lock()
00129         try:
00130             self.outputStream.write(data, len(data))
00131         finally:
00132             self._release()

Here is the call graph for this function:


Member Data Documentation

Reimplemented in xpcom.file.URIFile.

Definition at line 142 of file file.py.

Reimplemented in xpcom.file.LocalFile, and xpcom.file.URIFile.

Definition at line 97 of file file.py.

Definition at line 96 of file file.py.

Reimplemented in xpcom.file.LocalFile.

Definition at line 97 of file file.py.


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