File: //opt/gsutil/third_party/apitools/apitools/base/py/__pycache__/buffered_stream.cpython-39.pyc
a
�z�g
� @ s$ d Z ddlmZ G dd� de�ZdS )zSmall helper class to provide a small slice of a stream.
This class reads ahead to detect if we are at the end of the stream.
� )�
exceptionsc @ sV e Zd ZdZdd� Zdd� Zdd� Zedd � �Zed
d� �Z edd
� �Z
ddd�ZdS )�BufferedStreamzABuffers a stream, reading ahead to determine if we're at the end.c C sF || _ || _d| _| j �|�| _t| j�|k | _| jt| j� | _d S )Nr )�_BufferedStream__stream�_BufferedStream__start_pos�_BufferedStream__buffer_pos�read�_BufferedStream__buffered_data�len�_BufferedStream__stream_at_end�_BufferedStream__end_pos)�self�stream�start�size� r �D/opt/gsutil/third_party/apitools/apitools/base/py/buffered_stream.py�__init__ s zBufferedStream.__init__c C s d| j | j| j| jf S )Nz>Buffered stream %s from position %s-%s with %s bytes remaining)r r r �_bytes_remaining�r r r r �__str__&