Yields the encoding of this parameter
        If self.fileobj is set, then blocks of ``blocksize`` bytes are read and
        yielded.
357370
def iter_encode(self, boundary, blocksize=4096):
        """"""
        total = self.get_size(boundary)
        current = 0
        if self.value is not None:
            block = self.encode(boundary)
            current += len(block)
            yield block
            if self.cb:
                self.cb(self, current, total)
        else:
            block = self.encode_hdr(boundary)
            current += len(block)
            yield block
            if self.cb:
                self.cb(self, current, total)
            last_block = ""
            encoded_boundary = "--%s" % encode_and_quote(boundary)
            boundary_exp = re.compile("^%s$" % re.escape(encoded_boundary),
                                      re.M)
            while True:
                block = self.fileobj.read(blocksize)
                if not block:
                    current += 2
                    yield "\r\n"
                    if self.cb:
                        self.cb(self, current, total)
                    break
                last_block += block
                if boundary_exp.search(last_block):
                    raise ValueError("boundary found in file data")
                last_block = last_block[-len(encoded_boundary) - 2:]
                current += len(block)
                yield block
                if self.cb:
                    self.cb(self, current, total)
1373615
def compressed_bytes2ibytes(compressed, size):
    
    decompressor = zlib.decompressobj(16 + zlib.MAX_WBITS)
    for i in range(0, mo_math.ceiling(len(compressed), size), size):
        try:
            block = compressed[i: i + size]
            yield decompressor.decompress(block)
        except Exception as e:
            Log.error("Not expected", e)
27723
def read_blocks(stream):
    
    while True:
        header = _read_header(stream)
        block  = _read_block(header[1], stream)
        yield (header, block)
657454
def bytes_to_ustr(self, b):
        ""
        return b.decode(charset_map.get(self.charset, self.charset))
658073
void read(BlockId blk, IoBuffer buffer) {
		try {
			IoChannel fileChannel = getFileChannel(blk.fileName());

			// clear the buffer
			buffer.clear();

			// read a block from file
			fileChannel.read(buffer, blk.number() * BLOCK_SIZE);
		} catch (IOException e) {
			e.printStackTrace();
			throw new RuntimeException("cannot read block " + blk);
		}
	}
504609
def read_chunks(file, size=io.DEFAULT_BUFFER_SIZE):
    """"""
    while True:
        chunk = file.read(size)
        if not chunk:
            break
        yield chunk
1311060
protected int readBlock() throws IOException {
        blockSize = in.read();
        if (blockSize <= 0) {
            return blockSize = 0;
        }
        for (int k = 0; k < blockSize; ++k) {
            int v = in.read();
            if (v < 0) {
                return blockSize = k;
            }
            block[k] = (byte)v;
        }
        return blockSize;
    }
856509
def file_open(self, fn):
        
        yield b'--'
        yield self.boundary.encode()
        yield CRLF
        headers = content_disposition(fn)
        headers.update(content_type(fn))
        for c in self._write_headers(headers):
            yield c
555057
function( size, step, limit, callback ) {

    var args = [].slice.call( arguments )
    callback = args.pop()

    if( this.fd == null )
      return callback.call( this, new Error( 'Invalid file descriptor' ) )

    limit = args.pop() || 0x2000
    step  = args.pop() || 0x80
    size  = args.pop() || 0x200

    var self = this

    var readBlock = function() {

      var block = Buffer.allocUnsafe( size )

      self.fs.read( self.fd, block, 0, size, 0, function( error, bytesRead ) {

        if( error != null ) {
          // EINVAL tells us that the block size
          // ain't just right (yet); everything
          // else is probably user error
          if( error.code !== 'EINVAL' )
            return callback.call( self, error )
          // Increase the blocksize by `step`
          size += step
          // Attempt next size read
          return readBlock()
        }

        // Check if bytes read correspond
        // to current block size
        if( size !== bytesRead ) {
          error = new Error( 'Size and bytes read mismatch: ' + size + ', ' + bytesRead )
          return callback.call( self, error )
        }

        // Check if the limit has been reached,
        // and terminate with error, if so
        if( size > limit ) {
          error = new Error( 'Reached limit of ' + limit + ' bytes' )
          return callback.call( self, error )
        }

        // We've successfully found the
        // smallest readable block size;
        // stop looking...
        self.blockSize = size
        callback.call( self, null, size )

      })

    }

    // Start reading blocks
    readBlock()

    return this

  }
583443
def bz2_compress_stream(src, level=9):
    
    compressor = bz2.BZ2Compressor(level)
    for block in src:
        encoded = compressor.compress(block)
        if encoded:
            yield encoded
    yield compressor.flush()
427780
def _read_block(blocksize, stream):
    
    blockdata = stream.read(blocksize)
    return int.from_bytes(blockdata, 'big')
740930
def bz2_decompress_stream(src):
    
    dec = bz2.BZ2Decompressor()
    for block in src:
        decoded = dec.decompress(block)
        if decoded:
            yield decoded
856597
def ReadFile(self, filename):
    
    with io.open(filename, 'r', encoding='utf-8') as file_object:
      for artifact_definition in self.ReadFileObject(file_object):
        yield artifact_definition
592079
def read(self, b=-1):
        
        # Any negative value for b is interpreted as a full read
        # None is also accepted for legacy compatibility
        if b is None or b < 0:
            b = -1

        _LOGGER.debug("Stream read called, requesting %d bytes", b)
        output = io.BytesIO()

        if not self._message_prepped:
            self._prep_message()

        if self.closed:
            raise ValueError("I/O operation on closed file")

        if b >= 0:
            self._read_bytes(b)
            output.write(self.output_buffer[:b])
            self.output_buffer = self.output_buffer[b:]
        else:
            while True:
                line = self.readline()
                if not line:
                    break
                output.write(line)

        self.bytes_read += output.tell()
        _LOGGER.debug("Returning %d bytes of %d bytes requested", output.tell(), b)
        return output.getvalue()
1142755
def read_next_block(infile, block_size=io.DEFAULT_BUFFER_SIZE):
    """"""
    chunk = infile.read(block_size)

    while chunk:
        yield chunk

        chunk = infile.read(block_size)
62858
def _read_data(file_obj, fo_encoding, value_count, bit_width):
    
    vals = []
    if fo_encoding == parquet_thrift.Encoding.RLE:
        seen = 0
        while seen < value_count:
            values = encoding.read_rle_bit_packed_hybrid(file_obj, bit_width)
            if values is None:
                break  # EOF was reached.
            vals += values
            seen += len(values)
    elif fo_encoding == parquet_thrift.Encoding.BIT_PACKED:
        raise NotImplementedError("Bit packing not yet supported")

    return vals
249050
def read_block(self, block):
        
        self.seek(block.file_offset)
        return self._fhandle.read(block.size)