Package svnmailer :: Module stream :: Class TruncatingStream
[hide private]

Class TruncatingStream

source code

 object --+    
          |    
_BaseStream --+
              |
             TruncatingStream
Known Subclasses:

stream wrapper, which truncates after a limit

Instance Methods [hide private]
 
__init__(self, stream, maxsize, add_note=False)
Initialization
source code
 
write(self, towrite)
Writes a string up to the limit
source code
int
getTruncatedLineCount(self)
Returns the number of truncated lines
source code
 
writeWithoutTruncation(self, towrite)
Writes without truncation
source code
 
seek(self, position, mode=0)
Sets the file position
source code
 
getvalue(self)
Returns the content
source code

Inherited from _BaseStream: __getattr__, close, writelines

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
int current
The number of bytes received
str lastchar
The last character written
int maxsize
The maximum size in bytes
int trunced
The number of lines truncated (maybe actual-1)

Inherited from _BaseStream: stream

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, stream, maxsize, add_note=False)
(Constructor)

source code 

Initialization

Parameters:
  • stream (file like object) - The stream to wrap
  • maxsize (int) - The maximum size in bytes
Overrides: object.__init__

write(self, towrite)

source code 

Writes a string up to the limit

Parameters:
  • towrite - stuff to write
Overrides: _BaseStream.write

getTruncatedLineCount(self)

source code 

Returns the number of truncated lines

Returns: int
The line count

writeWithoutTruncation(self, towrite)

source code 

Writes without truncation

Parameters:
  • towrite (str) - The data to write