HEX
Server: LiteSpeed
System: Linux us-phx-web629.main-hosting.eu 5.14.0-503.23.2.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 12 05:52:18 EST 2025 x86_64
User: u756937133 (756937133)
PHP: 8.2.27
Disabled: passthru,chgrp
Upload Files
File: //opt/gsutil/third_party/apitools/apitools/base/py/__pycache__/buffered_stream.cpython-39.pyc
a

�z�g
�@s$dZddlmZGdd�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@sVeZdZdZdd�Zdd�Zdd�Zedd	��Zed
d��Z	edd
��Z
ddd�ZdS)�BufferedStreamzABuffers a stream, reading ahead to determine if we're at the end.cCsF||_||_d|_|j�|�|_t|j�|k|_|jt|j�|_dS)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__cCsd|j|j|j|jfS)Nz>Buffered stream %s from position %s-%s with %s bytes remaining)rrr�_bytes_remaining�rrrr�__str__&s
��zBufferedStream.__str__cCs
t|j�S�N)r	rrrrr�__len__+szBufferedStream.__len__cCs|jSr)r
rrrr�stream_exhausted.szBufferedStream.stream_exhaustedcCs|jSr)rrrrr�stream_end_position2sz"BufferedStream.stream_end_positioncCst|j�|jSr)r	rrrrrrr6szBufferedStream._bytes_remainingNcCsn|dus|dkr0t�d||j|j|j|jf��d}|jrjt||j�}|j|j|j|�}|j|7_|S)zReads from the buffer.NrzpIllegal read of size %s requested on BufferedStream. Wrapped stream %s is at position %s-%s, %s bytes remaining.�)	r�NotYetImplementedErrorrrrr�minrr)rr�datarrrr:s ����zBufferedStream.read)N)�__name__�
__module__�__qualname__�__doc__rrr�propertyrrrrrrrrrs


rN)r!�apitools.base.pyr�objectrrrrr�<module>s