def read(self): """Returns the contents of a file as a string. Starts reading from current position in file. """ self._preread_check() with errors.raise_exception_on_not_ok_status() as status: length = self.size() - self.tell() return pywrap_tensorflow.ReadFromStream(self._read_buf, length, status)
def read(self, n=-1): """Returns the contents of a file as a string. Starts reading from current position in file. Args: n: Read 'n' bytes if n != -1. If n = -1, reads to end of file. """ self._preread_check() with errors.raise_exception_on_not_ok_status() as status: if n == -1: length = self.size() - self.tell() else: length = n return pywrap_tensorflow.ReadFromStream(self._read_buf, length, status)
def read(self, n=-1): """Returns the contents of a file as a string. Starts reading from current position in file. Args: n: Read 'n' bytes if n != -1. If n = -1, reads to end of file. Returns: 'n' bytes of the file (or whole file) in bytes mode or 'n' bytes of the string if in string (regular) mode. """ self._preread_check() if n == -1: length = self.size() - self.tell() else: length = n return self._prepare_value( pywrap_tensorflow.ReadFromStream(self._read_buf, length))