public ChoAvroWriter(string filePath, ChoBSONRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = configuration; Init(); _streamWriter = new Lazy <StreamWriter>(() => new StreamWriter(ChoPath.GetFullPath(filePath), false, Configuration.Encoding, Configuration.BufferSize)); _closeStreamOnDispose = true; }
public ChoCSVReader(string filePath, ChoCSVRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = configuration; Init(); _textReader = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize); _closeStreamOnDispose = true; }
public ChoCSVReader <T> Load(string filePath) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Close(); Init(); _textReader = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize); _closeStreamOnDispose = true; return(this); }
public ChoFixedLengthWriter(string filePath, ChoFixedLengthRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = configuration; Init(); _textWriter = new StreamWriter(ChoPath.GetFullPath(filePath), false, Configuration.Encoding, Configuration.BufferSize); _closeStreamOnDispose = true; }
public ChoXmlReader(string filePath, ChoXmlRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = configuration; Init(); _xmlReader = XmlReader.Create(new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize), new XmlReaderSettings(), new XmlParserContext(null, Configuration.NamespaceManager, null, XmlSpace.None)); _closeStreamOnDispose = true; }
public ChoCSVReader(string filePath, ChoCSVRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); TraceSwitch = ChoETLFramework.TraceSwitch; Configuration = configuration; Init(); _streamReader = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.Encoding, false, Configuration.BufferSize); _closeStreamOnDispose = true; }
public ChoXmlReader(string filePath, string defaultNamespace, ChoXmlRecordConfiguration configuration = null) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = configuration; Init(); if (!defaultNamespace.IsNullOrWhiteSpace()) { Configuration.NamespaceManager.AddNamespace("", defaultNamespace); } _sr = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize); //InitXml(); _closeStreamOnDispose = true; }
public static string[] ReadAllLines(string filePath) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); filePath = ChoPath.GetFullPath(filePath); if (File.Exists(filePath)) { return(File.ReadAllLines(filePath)); } else { try { File.CreateText(filePath); } catch { } return(new string[] {}); } }
public ChoXmlReader(string filePath, string defaultNamespace) { ChoGuard.ArgumentNotNullOrEmpty(filePath, "FilePath"); Configuration = new ChoXmlRecordConfiguration(); if (!defaultNamespace.IsNullOrWhiteSpace()) { Configuration.NamespaceManager.AddNamespace("", defaultNamespace); } Init(); _sr = new StreamReader(ChoPath.GetFullPath(filePath), Configuration.GetEncoding(filePath), false, Configuration.BufferSize); _xmlReader = XmlReader.Create(_sr, new XmlReaderSettings() { DtdProcessing = DtdProcessing.Ignore, XmlResolver = null }, new XmlParserContext(null, Configuration.NamespaceManager, null, XmlSpace.None)); _closeStreamOnDispose = true; }