Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
codecs.StreamReaderWriter Class Reference
Collaboration diagram for codecs.StreamReaderWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def read
def readline
def readlines
def __next__
def __iter__
def write
def writelines
def reset
def seek
def __getattr__
def __enter__
def __exit__

Public Attributes

 stream
 reader
 writer
 errors

Static Public Attributes

string encoding = 'unknown'

Detailed Description

StreamReaderWriter instances allow wrapping streams which
    work in both read and write modes.

    The design is such that one can use the factory functions
    returned by the codec.lookup() function to construct the
    instance.

Definition at line 646 of file codecs.py.


Constructor & Destructor Documentation

def codecs.StreamReaderWriter.__init__ (   self,
  stream,
  Reader,
  Writer,
  errors = 'strict' 
)
Creates a StreamReaderWriter instance.

    stream must be a Stream-like object.

    Reader, Writer must be factory functions or classes
    providing the StreamReader, StreamWriter interface resp.

    Error handling is done in the same way as defined for the
    StreamWriter/Readers.

Definition at line 659 of file codecs.py.

00659 
00660     def __init__(self, stream, Reader, Writer, errors='strict'):
00661 
00662         """ Creates a StreamReaderWriter instance.
00663 
00664             stream must be a Stream-like object.
00665 
00666             Reader, Writer must be factory functions or classes
00667             providing the StreamReader, StreamWriter interface resp.
00668 
00669             Error handling is done in the same way as defined for the
00670             StreamWriter/Readers.
00671 
00672         """
00673         self.stream = stream
00674         self.reader = Reader(stream, errors)
00675         self.writer = Writer(stream, errors)
00676         self.errors = errors

Here is the caller graph for this function:


Member Function Documentation

Definition at line 725 of file codecs.py.

00725 
00726     def __enter__(self):
00727         return self

def codecs.StreamReaderWriter.__exit__ (   self,
  type,
  value,
  tb 
)

Definition at line 728 of file codecs.py.

00728 
00729     def __exit__(self, type, value, tb):
00730         self.stream.close()

Here is the caller graph for this function:

def codecs.StreamReaderWriter.__getattr__ (   self,
  name,
  getattr = getattr 
)
Inherit all other methods from the underlying stream.

Definition at line 717 of file codecs.py.

00717 
00718                     getattr=getattr):
00719 
00720         """ Inherit all other methods from the underlying stream.
00721         """
00722         return getattr(self.stream, name)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 694 of file codecs.py.

00694 
00695     def __iter__(self):
00696         return self

Return the next decoded line from the input stream.

Definition at line 689 of file codecs.py.

00689 
00690     def __next__(self):
00691 
00692         """ Return the next decoded line from the input stream."""
00693         return next(self.reader)

Here is the caller graph for this function:

def codecs.StreamReaderWriter.read (   self,
  size = -1 
)

Definition at line 677 of file codecs.py.

00677 
00678     def read(self, size=-1):
00679 
00680         return self.reader.read(size)

Here is the caller graph for this function:

def codecs.StreamReaderWriter.readline (   self,
  size = None 
)

Definition at line 681 of file codecs.py.

00681 
00682     def readline(self, size=None):
00683 
00684         return self.reader.readline(size)

Here is the caller graph for this function:

def codecs.StreamReaderWriter.readlines (   self,
  sizehint = None 
)

Definition at line 685 of file codecs.py.

00685 
00686     def readlines(self, sizehint=None):
00687 
00688         return self.reader.readlines(sizehint)

Definition at line 705 of file codecs.py.

00705 
00706     def reset(self):
00707 
00708         self.reader.reset()
00709         self.writer.reset()

Here is the caller graph for this function:

def codecs.StreamReaderWriter.seek (   self,
  offset,
  whence = 0 
)

Definition at line 710 of file codecs.py.

00710 
00711     def seek(self, offset, whence=0):
00712         self.stream.seek(offset, whence)
00713         self.reader.reset()
00714         if whence == 0 and offset == 0:
00715             self.writer.reset()

Here is the call graph for this function:

Here is the caller graph for this function:

def codecs.StreamReaderWriter.write (   self,
  data 
)

Definition at line 697 of file codecs.py.

00697 
00698     def write(self, data):
00699 
00700         return self.writer.write(data)

def codecs.StreamReaderWriter.writelines (   self,
  list 
)

Definition at line 701 of file codecs.py.

00701 
00702     def writelines(self, list):
00703 
00704         return self.writer.writelines(list)


Member Data Documentation

Definition at line 657 of file codecs.py.

Definition at line 675 of file codecs.py.

Definition at line 673 of file codecs.py.

Definition at line 672 of file codecs.py.

Definition at line 674 of file codecs.py.


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