diff --git a/src/IO/FileStream.php b/src/IO/FileStream.php new file mode 100644 index 0000000..b1e0aa1 --- /dev/null +++ b/src/IO/FileStream.php @@ -0,0 +1,12 @@ +phpStream = fopen($path, $mode); + stream_set_read_buffer($this->phpStream, 1024*1024); + $this->seek(0); + } +} diff --git a/src/IO/MemoryStream.php b/src/IO/MemoryStream.php new file mode 100644 index 0000000..97150c5 --- /dev/null +++ b/src/IO/MemoryStream.php @@ -0,0 +1,10 @@ +phpStream = fopen('php://memory', 'wb+'); + } +} diff --git a/src/MemoryStream.php b/src/IO/PhpStream.php similarity index 84% rename from src/MemoryStream.php rename to src/IO/PhpStream.php index db65d88..7bbbe2d 100644 --- a/src/MemoryStream.php +++ b/src/IO/PhpStream.php @@ -1,30 +1,13 @@ phpStream = fopen("php://memory", "wb+"); - } - - public function loadFromFile($path) - { - $this->phpStream = fopen($path, 'rb'); - stream_set_read_buffer($this->phpStream, 1024*1024); - $this->seek(0); - } - /** * @param int $bytesCount How many bytes to read * @param array $buffer Reference to buffer array where read bytes will be written @@ -109,4 +92,4 @@ public function hasReachedEOF() { return feof($this->phpStream); } -} \ No newline at end of file +}