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    }