protected void ProcessValueToOutput(SystemIO.Stream stream, FlatFileDefinition <TIn> mapping, TIn value)
 {
     _streamWriter.WriteLine(_serialize.Serialize(value));
 }
Example #2
0
 public static ISingleStream <IFileValue> ToTextFileValue <TIn>(this IStream <Correlated <TIn> > stream, string name, string fileName, FlatFileDefinition <TIn> mapping, Dictionary <string, IEnumerable <Destination> > destinations = null, object extraMetadata = null, Encoding encoding = null)
 {
     return(new ToFileValueStreamNode <Correlated <TIn>, TIn>(name, new ToTextDataStreamArgs <Correlated <TIn>, TIn>
     {
         MainStream = stream,
         Mapping = mapping,
         GetRow = i => i.Row,
         FileName = fileName,
         Encoding = encoding,
         Metadata = extraMetadata,
         Destinations = destinations
     }).Output);
 }
 private void PreProcess(SystemIO.Stream stream, FlatFileDefinition <TIn> mapping)
 {
     _streamWriter = new StreamWriter(stream, Encoding.Default, 1024, true);
     this.ExecutionContext.AddDisposable(_streamWriter);
     _streamWriter.WriteLine(mapping.GenerateDefaultHeaderLine());
 }
Example #4
0
        public static IStream <TOut> CrossApplyTextFile <TParsed, TOut>(this IStream <IFileValue> stream, string name, FlatFileDefinition <TParsed> args, Func <IFileValue, TParsed, TOut> resultSelector, bool noParallelisation = false)
        {
            var valuesProvider = new FlatFileValuesProvider <TParsed, TOut>(new FlatFileValuesProviderArgs <TParsed, TOut>()
            {
                Mapping        = args,
                ResultSelector = resultSelector
            });

            return(stream.CrossApply <IFileValue, TOut>(name, valuesProvider, noParallelisation));
        }