Preserve line endings while filtering

The current implementation of the filter replaces all line endings of
input files with the platform-specific variant. For example, this leads to
problems with shell scripts on the Docker host, if the library is used on
Windows.

The changed filter algorithm preserves the line endings.
Merge pull request #10 from cheinema/preserve-line-endings-while-filtering

Preserve line endings while filtering