to.tetramorph.util
クラス CSVWriter

java.lang.Object
  上位を拡張 java.io.Writer
      上位を拡張 java.io.BufferedWriter
          上位を拡張 to.tetramorph.util.CSVWriter
すべての実装されたインタフェース:
Closeable, Flushable, Appendable

public class CSVWriter
extends BufferedWriter

Microsof ExcelのCSV形式でString[]に格納された値を書き出すことができます。


フィールドの概要
 
クラス java.io.Writer から継承されたフィールド
lock
 
コンストラクタの概要
CSVWriter(File file, char separator, String csn)
          バッファリングされた出力ストリームを作成します。
CSVWriter(File file, String csn)
          バッファリングされた出力ストリームを作成します。
CSVWriter(String filename, String csn)
          バッファリングされた出力ストリームを作成します。
 
メソッドの概要
static String getCSVString(String[] cols, char separator)
          文字配列をCSV形式の文字列表現にして返す。
 void writeCSV(String[] cols)
          文字配列をストリームに書き出す。
 
クラス java.io.BufferedWriter から継承されたメソッド
close, flush, newLine, write, write, write
 
クラス java.io.Writer から継承されたメソッド
append, append, append, write, write
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

CSVWriter

public CSVWriter(File file,
                 String csn)
          throws IOException
バッファリングされた出力ストリームを作成します。 作成します。

パラメータ:
file - 出力するファイル
csn - 文字コードセット(ECU,SJIS,UTF-8等)
例外:
IOException - IOエラー

CSVWriter

public CSVWriter(String filename,
                 String csn)
          throws IOException
バッファリングされた出力ストリームを作成します。

パラメータ:
filename - ファイル名
csn - 文字コードセット(SJIS,EUC,UTF-8等)
例外:
IOException - IOエラー

CSVWriter

public CSVWriter(File file,
                 char separator,
                 String csn)
          throws IOException
バッファリングされた出力ストリームを作成します。

パラメータ:
file - ファイル
separator - ','か'\t'等。
csn - 文字コードセット(SJIS,EUC,UTF-8等)
例外:
IOException - IOエラー
メソッドの詳細

writeCSV

public void writeCSV(String[] cols)
              throws IOException
文字配列をストリームに書き出す。

パラメータ:
cols - 1行分の列データを配列で指定する。
例外:
IOException - IOエラー

getCSVString

public static String getCSVString(String[] cols,
                                  char separator)
文字配列をCSV形式の文字列表現にして返す。

パラメータ:
cols - 1行分の列データ
戻り値:
colsがCSV表現にされた文字列。