C# Class Azavea.NijPredictivePolicing.Common.Data.TabSeparatedValueWriter

a basic implementation of the IDataWriter interface, so we can simply export tab separated value files
Inheritance: IDataFileWriter
Afficher le fichier Open project: azavea/acs-alchemist

Protected Properties

Свойство Type Description
_filename string
_line StringBuilder
_outputStream System.IO.StreamWriter
_splitChars char[]

Méthodes publiques

Méthode Description
Close ( ) : bool

closes the underlying stream

CreateTable ( string tablename, IEnumerable columns ) : bool

simply appends the column row. call this first! (you would have to call this first anyway.)

Flush ( ) : bool

flushes the stream

MakeColumnLine ( List columns ) : string

allows you to use any functional writable stream

build a column line (first line in a delim-separated value file)

MakeFormatLine ( List columns ) : string

generate a String.Format line based on our column count

SetTablename ( string tableName ) : void

changes the currently active table, does nothing for this type of file, since it only contains one table.

SetWriteFile ( string filename ) : bool

specify an output file for APPENDing to, and sharing reading. (if you don't like it, send in your own filestream :)

TabSeparatedValueWriter ( ) : System

construct a new blank writer (any writes will throw exceptions if you don't set a stream or a file!)

TabSeparatedValueWriter ( string filename ) : System

construct a new writer to append to the given file

WriteLine ( IEnumerable values ) : bool

Make sure you have a value for every column! This is really intentionally not thread safe, do not share this class across threads. really, don't write one of these files across multiple threads at the same time.

WriteLine ( string line ) : bool

Write a line directly to our output

Method Details

Close() public méthode

closes the underlying stream
public Close ( ) : bool
Résultat bool

CreateTable() public méthode

simply appends the column row. call this first! (you would have to call this first anyway.)
public CreateTable ( string tablename, IEnumerable columns ) : bool
tablename string
columns IEnumerable
Résultat bool

Flush() public méthode

flushes the stream
public Flush ( ) : bool
Résultat bool

MakeColumnLine() public méthode

allows you to use any functional writable stream build a column line (first line in a delim-separated value file)
public MakeColumnLine ( List columns ) : string
columns List
Résultat string

MakeFormatLine() public méthode

generate a String.Format line based on our column count
public MakeFormatLine ( List columns ) : string
columns List
Résultat string

SetTablename() public méthode

changes the currently active table, does nothing for this type of file, since it only contains one table.
public SetTablename ( string tableName ) : void
tableName string
Résultat void

SetWriteFile() public méthode

specify an output file for APPENDing to, and sharing reading. (if you don't like it, send in your own filestream :)
public SetWriteFile ( string filename ) : bool
filename string
Résultat bool

TabSeparatedValueWriter() public méthode

construct a new blank writer (any writes will throw exceptions if you don't set a stream or a file!)
public TabSeparatedValueWriter ( ) : System
Résultat System

TabSeparatedValueWriter() public méthode

construct a new writer to append to the given file
public TabSeparatedValueWriter ( string filename ) : System
filename string
Résultat System

WriteLine() public méthode

Make sure you have a value for every column! This is really intentionally not thread safe, do not share this class across threads. really, don't write one of these files across multiple threads at the same time.
public WriteLine ( IEnumerable values ) : bool
values IEnumerable
Résultat bool

WriteLine() public méthode

Write a line directly to our output
public WriteLine ( string line ) : bool
line string
Résultat bool

Property Details

_filename protected_oe property

an internal copy of our filename
protected string _filename
Résultat string

_line protected_oe property

our buffer for constructing lines
protected StringBuilder _line
Résultat StringBuilder

_outputStream protected_oe property

our wrapper around any provided stream
protected StreamWriter,System.IO _outputStream
Résultat System.IO.StreamWriter

_splitChars protected_oe property

the tab, for the tab-separated part
protected char[] _splitChars
Résultat char[]