#NEWLINE# def read( self , size ) : #NEWLINE# #INDENT# if ( self . _slurp is not None ) : #NEWLINE# #INDENT# return self . _slurp . read ( data ) #NEWLINE# #UNINDENT# ( data , buffer_size ) = ( bytearray ( ) , 0 ) #NEWLINE# if self . _buffer : #NEWLINE# #INDENT# buffer_size = len ( self . _buffer ) #NEWLINE# data . extend ( self . _buffer ) #NEWLINE# #UNINDENT# for char in self . _reader . read ( ( size - buffer_size ) ) : #NEWLINE# #INDENT# if ( char == ord ( '\n' ) ) : #NEWLINE# #INDENT# data . extend ( [ ord ( '\r' ) , ord ( '\n' ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( char == ord ( '\r' ) ) : #NEWLINE# #INDENT# data . extend ( [ ord ( '\r' ) , 0 ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data . append ( char ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . _buffer = bytearray ( data [ size : ] ) #NEWLINE# return data [ : size ]