001 /*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016 package org.opengion.plugin.io;
017
018 import java.io.PrintWriter;
019
020 import org.opengion.hayabusa.db.DBTableModel;
021
022 /**
023 * 固定長æ–?—ファイルの書きå?しクラスですã?
024 * DefaultTableWriter を継承してã�?�¾すã?で?Œラベル?Œ名前,サイズ?Œデータの
025 * 出力部のみオーバã?ライドして?Œ固定長æ–?—ファイルの出力機è?を実現してã�?�¾すã?
026 *
027 * なお,固定長出力されるのは?Œデータ部のみで?Œラベル?Œ名前,サイズは??
028 * separator でæŒ?®šされた区åˆ?‚Š記号で連結されて出力されますã?
029 *
030 * @og.group ファイル出åŠ?
031 *
032 * @version 4.0
033 * @author Kazuhiko Hasegawa
034 * @since JDK5.0,
035 */
036 public class TableWriter_Fixed extends TableWriter_Default {
037 //* こã?プログラãƒ??VERSIONæ–?—å?を設定しますã? {@value} */
038 private static final String VERSION = "4.0.0.0 (2005/08/31)" ;
039
040 // /**
041 // * ãƒ?ƒ•ォルトコンストラクター
042 // *
043 // */
044 // public TableWriter_Fixed() {
045 // super();
046 // }
047
048 /**
049 * PrintWriter に DBTableModelのãƒ??ブルæƒ??を書き込みますã?
050 *
051 * @og.rev 2.3.1.2 (2003/01/28) ãƒ??タ出力時に、改行が余å?に出されるç®?‰€を修正ã€?
052 * @og.rev 3.1.1.0 (2003/03/28) 同期メソãƒ?ƒ‰(synchronized付き)を非同期に変更するã€?
053 * @og.rev 3.5.4.5 (2004/01/23) æ–?—å?のエンコード指å®?桁数判å®?
054 *
055 * @param table DBTableModelオブジェクãƒ?
056 * @param writer PrintWriterオブジェクãƒ?
057 */
058 @Override
059 protected void writeData( final DBTableModel table,final PrintWriter writer ) {
060 int numberOfRows = table.getRowCount();
061 String encode = getEncode();
062
063 for( int row=0; row<numberOfRows; row++ ) {
064 for( int i=0; i<numberOfColumns; i++ ) {
065 int clm = clmNo[i];
066 writer.print( dbColumn[clm].getWriterValue( table.getValue(row,clm),encode ) );
067 }
068 writer.println();
069 }
070 }
071 }