Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
fd: file descriptor where to write
data: data to write
buf_size: size of the buffer (default 1MB)
buffered write handling case when write returns nb of written bytes
and when write returns None (Linux)

        def buffered_write(fd, data, buf_size = 1048576):
    """
       fd: file descriptor where to write
       data: data to write
       buf_size: size of the buffer (default 1MB)
       buffered write handling case when write returns nb of written bytes
       and when write returns None (Linux)
    """
    #LOG.critical("======= In buffered write")
    total_size = len(data)
    wr_bytes = 0
    while wr_bytes < total_size:
        written = fd.write(buffer(data, wr_bytes, buf_size))
        if written:
            wr_bytes += written
        else:
            #if buffer size > left then left else buffer size
            # else buffer size
            left = total_size - wr_bytes
            if left < buf_size:
                wr_bytes += left
            else:
                wr_bytes += buf_size
        


src/g/m/gmvault-HEAD/src/gmv/gmvault_db.py   gmvault(Download)
            cipher.initCTR()
            data     = cipher.encryptCTR(email_info[imap_utils.GIMAPFetcher.EMAIL_BODY])
            gmvault_utils.buffered_write(data_desc, data) if len(data) > 4194304 else data_desc.write(data)
        else:
 
            data = email_info[imap_utils.GIMAPFetcher.EMAIL_BODY]
            #data_desc.write(data)
            gmvault_utils.buffered_write(data_desc, data) if len(data) > 4194304 else data_desc.write(data)

src/g/m/gmvault-1.8.1-beta/src/gmv/gmvault_db.py   gmvault(Download)
            cipher.initCTR()
            data     = cipher.encryptCTR(email_info[imap_utils.GIMAPFetcher.EMAIL_BODY])
            gmvault_utils.buffered_write(data_desc, data) if len(data) > 4194304 else data_desc.write(data)
        else:
 
            data = email_info[imap_utils.GIMAPFetcher.EMAIL_BODY]
            #data_desc.write(data)
            gmvault_utils.buffered_write(data_desc, data) if len(data) > 4194304 else data_desc.write(data)