mdurrant/php-binary-reader — pull request #6 by jwpage (2014-08-21 23:59:11+00:00)
Title: Use file resources for BinaryReader

Hi,

I've modified this package to operate on resources instead of strings. This ends up having considerable memory benefits, especially when working with larger files, as you don't need to read the entire file into memory. I've got a basic benchmark here: https://gist.github.com/jwpage/939f87fe2cf2220e7a54

* This maintains 100% PSR2 and test coverage.
* This maintains backwards compatibility:
* `__construct()` will create an in-memory resource if you pass in a string.
* `getInputString()` will read out the contents of your resource, regardless of whether the BinaryReader was created with a resource or a string.
* There are a lot of changes in the `test` dir because I've changed it to use `@dataProviders` (defined in `AbstractTestCase`) so you can see that both file resource and string BinaryReaders pass the tests.

Thanks for this package, it makes working with binary files much easier!