diff --git a/src/FlatFile.Core/IFlatFileMultiEngine.cs b/src/FlatFile.Core/IFlatFileMultiEngine.cs index a47b36d..e61dd4d 100644 --- a/src/FlatFile.Core/IFlatFileMultiEngine.cs +++ b/src/FlatFile.Core/IFlatFileMultiEngine.cs @@ -14,6 +14,11 @@ public interface IFlatFileMultiEngine : IFlatFileEngine /// The stream. void Read(Stream stream); /// + /// Reads the specified stream reader. + /// + /// The stream reader. + void Read(StreamReader streamReader); + /// /// Gets any records of type read by . /// /// diff --git a/src/FlatFile.FixedLength/Implementation/FixedLengthFileMultiEngine.cs b/src/FlatFile.FixedLength/Implementation/FixedLengthFileMultiEngine.cs index 360e4f5..59f4477 100644 --- a/src/FlatFile.FixedLength/Implementation/FixedLengthFileMultiEngine.cs +++ b/src/FlatFile.FixedLength/Implementation/FixedLengthFileMultiEngine.cs @@ -138,6 +138,27 @@ protected override bool TryParseLine(string line, int lineNumber, ref T public void Read(Stream stream) { var reader = new StreamReader(stream); + ReadInternal(reader); + } + + /// + /// Reads the specified stream reader. + /// + /// The stream reader. + /// Impossible to parse line + public void Read(StreamReader reader) + { + ReadInternal(reader); + } + + /// + /// Internal method (private) to read from streamreader instead of stream + /// This way the client code have a way to specify encoding. + /// + /// The stream reader to read. + /// Impossible to parse line + private void ReadInternal(StreamReader reader) + { string line; var lineNumber = 0;