for compatibility with file-like objects
Merge pull request #3 from Gluejar/master

for compatibility with file-like objects