模拟java.io的IO流类

dev-main 2024-06-08 13:14 UTC

This package is auto-updated.

Last update: 2024-09-08 13:46:59 UTC


README

模拟java.io的IO流类

use antibiotics11\Stream\FileOutputStream;

$helloWorldFile = new FileOutputStream(name: "hello_world.txt", append: true);
for ($i = 0; $i < 10; $i++) {
    $helloWorldFile->write(bytes: "Hello, World!\r\n");
}
$helloWorldFile->flush();
$helloWorldFile->close();

  • Stream\InputStream
  • Stream\OutputStream
  • Stream\FileInputStream
  • Stream\FileOutputStream
  • Stream\BufferedOutputStream
  • Stream\StandardInputStream [已弃用]
  • Stream\StandardOutputStream [已弃用]

异常

  • Stream\Exception\IOException
  • Stream\Exception\FileNotFoundException

注意

  • 该项目是实验性的,不能保证与java.io具有相同的功能。
  • 由于模仿带有可选参数的重载方法,一些功能可能不稳定。

要求

安装

composer require antibiotics11/stream:dev-main