Sindbad~EG File Manager
�
&ٜg=6 � � � d dl mZ d dlZd dlZd dlZd dlmZ d dlmZm Z ddl
mZmZm
Z
mZ G d� d� Zdd �Zdd
�Z dd�Z G d� d
ej � Zdd�Zdd�Z ej, ej. ee� ej0 ej. e� ej2 ej. g d�� ej4 ej. d� y)� )�annotationsN)�Callable)�IO�cast� )�Image� ImageFile�ImagePalette�_binaryc �J � e Zd ZdZd
dd�Zdd�Zd
d�Zdd�Zdd�Zdd�Z dd�Z
y )� BoxReaderz}
A small helper class to read fields stored in JPEG2000 header boxes
and to easily step into and read sub-boxes.
c �B � || _ |dk\ | _ || _ d| _ y )Nr ���)�fp�
has_length�length�remaining_in_box)�selfr r s �@/usr/local/lib/python3.12/site-packages/PIL/Jpeg2KImagePlugin.py�__init__zBoxReader.__init__! s# � ���� �A�+������ "��� c � � | j r+| j j � |z | j kD ry| j dk\ r|| j k S y)NFr T)r r �tellr r )r � num_bytess r � _can_readzBoxReader._can_read'