docstr: Read up to n bytes from the underlying file, with buffering.
  
  Reads are satisfied from a buffer of previous data read starting at
  `self._buffer_pos` until the buffer is exhausted, and then from the
  actual underlying file. Any new data is added to the buffer, and
  `self._buffer_pos` is advanced to the point in the buffer past all
  data returned as part of this read.
  
  Args:
    n: non-negative number of bytes to read
  
  Returns:
    bytestring of data read, up to n bytes
docstr_tok: ["Read","up","to","n","bytes","from","the","underlying","file",",","with","buffering",".","Reads","are","satisfied","from","a","buffer","of","previous","data","read","starting","at","`","self._buffer_pos","`","until","the","buffer","is","exhausted",",","and","then","from","the","actual","underlying","file",".","Any","new","data","is","added","to","the","buffer",",","and","`","self._buffer_pos","`","is","advanced","to","the","point","in","the","buffer","past","all","data","returned","as","part","of","this","read",".","Args",":","n",":","non-negative","number","of","bytes","to","read","Returns",":","bytestring","of","data","read",",","up","to","n","bytes"]
code: def _read(self, n):
      """Read up to n bytes from the underlying file, with buffering.
  
      Reads are satisfied from a buffer of previous data read starting at
      `self._buffer_pos` until the buffer is exhausted, and then from the
      actual underlying file. Any new data is added to the buffer, and
      `self._buffer_pos` is advanced to the point in the buffer past all
      data returned as part of this read.
  
      Args:
        n: non-negative number of bytes to read
  
      Returns:
        bytestring of data read, up to n bytes
      """
      result = self._buffer[self._buffer_pos : self._buffer_pos + n]
      self._buffer_pos += len(result)
      n -= len(result)
      if n > 0:
          new_data = self.file_handle.read(n)
          result += new_data
          self._buffer += new_data
          self._buffer_pos += len(new_data)
      return result
  
file_path: tensorboard/tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py
imports: import array
  import struct
  from .None import errors
  from .io import gfile
label_desc: Use image node_id 3 for calling the PyRecordReader_New obj's underlying member method code with example usage: obj._read(n) and returns: result