from os import PathLike
from typing import Self, Sequence, Type, TypeVar

T = TypeVar("T", bound=bytes | str)

class StringBuffer[T]:
    softspace: int
    closed: bool
    string_list: Sequence[T]
    current_value: T
    btype: Type
    dirty: bool
    current_position: int
    current_size: int
    fast: bool

    def __init__(self, fast: bool = ..., btype: Type | None = ...): ...
    def read(self, size: int | None = None) -> T: ...
    def write(self, string_value: T) -> int: ...
    def close(self): ...
    def flush(self): ...
    def reset(self): ...
    def seek(self, offset: int, whence: int = ...): ...
    def eof(self) -> bool: ...
    def next(self): ...
    def tell(self) -> int: ...
    def truncate(self): ...
    def readline(self, size: int | None = None) -> T: ...
    def readlines(self, sizehint: int | None = None) -> Sequence[T]: ...
    def writelines(self, lines: Sequence[T]): ...
    def isatty(self) -> bool: ...
    def getvalue(self) -> T: ...
    def get_value(self) -> T: ...
    def is_empty(self) -> bool: ...
    def regenerate(self): ...
    def duplicate(self) -> Self: ...
    def rollback_last(self, item_count: int = ...): ...
    def get_last(self, index: int = ...) -> T: ...
    def output_file(self, path: PathLike[str]): ...
    def _write_fast(self, string_value: T): ...
    def _write_slow(self, string_value: T): ...
    def _regenerate(self): ...
    def _base_type(self) -> Type: ...
