chigix / io-component
PHP IO 组件
0.1.2
2015-03-17 11:13 UTC
Requires
- php: >=5.4
- symfony/filesystem: *
Requires (Dev)
This package is not auto-updated.
Last update: 2024-09-24 03:33:46 UTC
README
IO 组件为系统输入输出提供了大量基础类,如流、序列化和文件系统。
如果你熟悉 JDK 中的 java.io,你可能会很快开始使用这个组件。
此外,此组件提供了流编程风格下任何使用场景所需的通用文件系统功能。
$input = Chigi\Component\IO\StdInputStream::getInstance(); echo $input->readLine();
此外,你可以通过扩展基流类轻松创建支持流操作的自定义 io 工具。
class RoboOutputStream extends \Chigi\Component\IO\OutputStream { protected function writeString($string) { \Robo\Runner::getPrinter()->write($string); } public function close() { } public function flush() { } }
然后,你可以直接在 FileSystem IO、网络套接字 IO 脚本逻辑中使用你自己的新流。听起来很激动人心,对吧?
此组件提供了一系列抽象基类和接口的日志,如 InputStream、OutputStream、EOFException 等。