Support parsing from an already open file handle.
Created by: andrewyatz
This changes the code in TextParser to check if the given filename was a file handle. If it is a file handle the code just assigns it and assumes you know what you are doing.
There was also some cleaning up of the open_content() method to delegate to open() once it had created the in-memory filehandle. It seemed odd not to do once open() could support open filehandles.
Merge request reports
Activity
Created by: muffato
Do you think TextParser::open() should do a seek() to reset the position to the beginning of the file ? I'm thinking of the scenario where some code opens a file, reads the first bytes to discover which type it is, and then give the file-handle to the relevant ensembl-io parser.
Created by: andrewyatz
Hmmm. I would say no. In the code you’re describing I’d want the code doing that sniffing to reset the file handle position. Otherwise it’s just code second guessing a situation which we may never develop
On 18 Aug 2015, at 17:24, Matthieu Muffato notifications@github.com wrote:
Do you think TextParser::open() should do a seek() to reset the position to the beginning of the file ? I'm thinking of the scenario where some code opens a file, reads the first bytes to discover which type it is, and then give the file-handle to the relevant ensembl-io parser.
— Reply to this email directly or view it on GitHub https://github.com/Ensembl/ensembl-io/pull/17#issuecomment-132265912.