thesis/byte-buffer

The library implements buffered I/O.

0.1.0 2025-01-16 16:14 UTC

This package is auto-updated.

Last update: 2025-01-17 11:53:26 UTC


README

Installation

composer require thesis/byte-buffer

Basic usage

<?php

declare(strict_types=1);

use Thesis\ByteBuffer\BufferedReader;
use Thesis\ByteBuffer\BufferedWriter;
use Thesis\ByteBuffer\BufferedReaderWriter;

$reader = new BufferedReader(/* an implementation of Thesis\ByteReader\Reader */);
$reader->read(10)

$writer = new BufferedWriter(/* an implementation of Thesis\ByteReader\Writer */)
$writer->write('test');

$rw = new BufferedReaderWriter(
    /* an implementation of Thesis\ByteReader\Reader or Thesis\ByteReader\Reader&Thesis\ByteReader\Writer */,
    /* an implementation of ?Thesis\ByteReader\Writer */,
);

$rw->write('test');
$rw->read(4);
$rw->flush();