<?php
/**
 * -----------------------------------------------------------------------------
 *
 * SyL - Web Application Framework for PHP
 *
 * PHP version 4 (>= 4.3.x) or 5
 *
 * Copyright (C) 2006 k.watanabe
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * -----------------------------------------------------------------------------
 * @package   SyL
 * @author    k.watanabe <k.watanabe@syl.jp>
 * @copyright 2006 k.watanabe
 * @license   http://www.opensource.org/licenses/lgpl-license.php
 * @version   CVS: $Id: SyL_File.php,v 1.7 2006/12/23 11:13:09 seasonstream Exp $
 * @link      http://www.syl.jp/
 * -----------------------------------------------------------------------------
 */

/**
 * ファイルクラス
 *
 * @package   SyL
 * @author    k.watanabe <k.watanabe@syl.jp>
 * @copyright 2006 k.watanabe
 * @license   http://www.opensource.org/licenses/lgpl-license.php
 * @version   CVS: $Id: SyL_File.php,v 1.7 2006/12/23 11:13:09 seasonstream Exp $
 * @link      http://www.syl.jp/
 */
class SyL_File
{
    /**
     * ファイル名
     * 
     * @access public
     */
    var $file_name;
    /**
     * ファイルサイズ
     * 
     * @access public
     */
    var $file_size = null;
    /**
     * ファイルポインタ
     * 
     * @access public
     */
    var $fp = null;

    /**
     * コンストラクタ
     *
     * @access public
     * @param string ファイル名
     */
    function SyL_File($file_name)
    {
        if (file_exists($file_name)) {
            $this->file_size = filesize($file_name);
        }
        $this->file_name = $file_name;
    }

    /**
     * ファイルを開く
     *
     * @access public
     */
    function open( $mode )
    {
        $this->fp = fopen( $this->file_name, $mode );
        if (!is_resource($this->fp)) {
            trigger_error( "[SyL error] File not found or Permission denied ({$this->file_name})", E_USER_ERROR );
        } 
    }

    /**
     * ファイルを閉じる
     *
     * @access public
     */
    function close()
    {
        if (is_resource($this->fp)) {
            fclose( $this->fp );
        }
    }

    /**
     * ファイルから読み込む
     *
     * @access public
     */
    function read() {}

    /**
     * ファイルに出力する
     *
     * @access public
     * @param string メッセージ
     */
    function write( $message ) {}

}

?>
