Skip to content

Commit

Permalink
Construct SeqStream by file descriptor
Browse files Browse the repository at this point in the history
Add new constructor to construct SeqStreams by file descriptor instead
of file path.
  • Loading branch information
cartoonist committed Aug 29, 2018
1 parent 5407251 commit 815fbf0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/seqio.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ namespace klibpp {
SeqStreamIn( const char* filename )
: base_type( gzopen( filename, "r" ), gzread, gzclose )
{ }

SeqStreamIn( int fd )
: base_type( gzdopen( fd, "r" ), gzread, gzclose )
{ }
};

class SeqStreamOut
Expand All @@ -44,6 +48,10 @@ namespace klibpp {
SeqStreamOut( const char* filename, bool compressed=false )
: base_type( gzopen( filename, ( compressed ? "w" : "wT" ) ), gzwrite, gzclose )
{ }

SeqStreamOut( int fd, bool compressed=false )
: base_type( gzdopen( fd, ( compressed ? "w" : "wT" ) ), gzwrite, gzclose )
{ }
};
} /* ----- end of namespace klibpp ----- */
#endif /* ----- #ifndef SEQIO_H__ ----- */

0 comments on commit 815fbf0

Please sign in to comment.