#NEWLINE# def read( self , n = 4096 ) : #NEWLINE# #INDENT# '\n        Return `n` bytes of data from the Stream, or None at end of stream.\n        ' #NEWLINE# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if hasattr ( self . fd , 'recv' ) : #NEWLINE# #INDENT# return self . fd . recv ( n ) #NEWLINE# #UNINDENT# return os . read ( self . fd . fileno ( ) , n ) #NEWLINE# #UNINDENT# except EnvironmentError as e : #NEWLINE# #INDENT# if ( e . errno not in Stream . ERRNO_RECOVERABLE ) : #NEWLINE# #INDENT# raise e