C# 클래스 Azavea.NijPredictivePolicing.Common.Data.CommaSeparatedValueWriter

A basic implementation of the IDataWriter interface, so we can simply export CSV files. Should be compliant with RFC4180 ( http://tools.ietf.org/html/rfc4180 ).
상속: IDataFileWriter
파일 보기 프로젝트 열기: azavea/acs-alchemist 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
_filename string
_line StringBuilder
_outputStream System.IO.StreamWriter
_splitChars char[]

공개 메소드들

메소드 설명
Close ( ) : bool

closes the underlying stream

CommaSeparatedValueWriter ( ) : System

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

CommaSeparatedValueWriter ( string filename ) : System

construct a new writer to append to the given file

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

QuoteAndEscape ( string input ) : string

If input contains ,s or newlines, escapes all "s and brackets in "s and returns the result, otherwise returns input unmodified

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 :)

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

메소드 상세

Close() 공개 메소드

closes the underlying stream
public Close ( ) : bool
리턴 bool

CommaSeparatedValueWriter() 공개 메소드

construct a new blank writer (any writes will throw exceptions if you don't set a stream or a file!)
public CommaSeparatedValueWriter ( ) : System
리턴 System

CommaSeparatedValueWriter() 공개 메소드

construct a new writer to append to the given file
public CommaSeparatedValueWriter ( string filename ) : System
filename string
리턴 System

CreateTable() 공개 메소드

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
리턴 bool

Flush() 공개 메소드

flushes the stream
public Flush ( ) : bool
리턴 bool

QuoteAndEscape() 공개 메소드

If input contains ,s or newlines, escapes all "s and brackets in "s and returns the result, otherwise returns input unmodified
public QuoteAndEscape ( string input ) : string
input string The string to escape and quote (if necessary)
리턴 string

SetTablename() 공개 메소드

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
리턴 void

SetWriteFile() 공개 메소드

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
리턴 bool

WriteLine() 공개 메소드

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
리턴 bool

WriteLine() 공개 메소드

Write a line directly to our output
public WriteLine ( string line ) : bool
line string
리턴 bool

프로퍼티 상세

_filename 보호되어 있는 프로퍼티

an internal copy of our filename
protected string _filename
리턴 string

_line 보호되어 있는 프로퍼티

our buffer for constructing lines
protected StringBuilder _line
리턴 StringBuilder

_outputStream 보호되어 있는 프로퍼티

our wrapper around any provided stream
protected StreamWriter,System.IO _outputStream
리턴 System.IO.StreamWriter

_splitChars 보호되어 있는 프로퍼티

the tab, for the tab-separated part
protected char[] _splitChars
리턴 char[]