Skip to content

Use file resources for BinaryReader#6

Merged
mdurrant merged 7 commits into
mdurrant:masterfrom
jwpage:use_resources
Aug 22, 2014
Merged

Use file resources for BinaryReader#6
mdurrant merged 7 commits into
mdurrant:masterfrom
jwpage:use_resources

Conversation

@jwpage

@jwpage jwpage commented Aug 21, 2014

Copy link
Copy Markdown
Contributor

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!

@mdurrant

Copy link
Copy Markdown
Owner

Really nice, thanks for contributing!

mdurrant added a commit that referenced this pull request Aug 22, 2014
Use file resources for BinaryReader
@mdurrant mdurrant merged commit a40e04c into mdurrant:master Aug 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants