ts.util.resource
クラス PropertyResource

java.lang.Object
  上位を拡張 ts.util.resource.AbstractResource
      上位を拡張 ts.util.resource.DefaultResource
          上位を拡張 ts.util.resource.PropertyResource
すべての実装されたインタフェース:
Resource

public class PropertyResource
extends DefaultResource

プロパティファイルを対象とするリソースクラス。
Javaプロパティファイルをロードして、その内容から指定されたキーに対する値を 取得する。
Propertiesクラスでは、プロパティファイルのキーの プロパティファイルのキーの書式は一般的に、

    要素1.要素2.要素3 = 値
のように記述され、プロパティキーと値を1対1でしか設定できない。
これに対し、このクラスではResourceクラス のリソースキーの書式に従って記述されたプロパティキーを解釈できるようにして おり、これによって1つのキーが複数の値を持ったり、同じキーが属性値によって 異なる値を持つことができるようにしている。
属性を持ったプロパティキーの書式の例を以下に示す。
    要素1.要素2(属性名1\=属性値1,属性名2\=属性値2).要素3 = 値
但し、属性の名前と値を結合する等号(=)は、エスケープする('\'記号を前に付加 する)必要がある。

バージョン:
$Revision: 1.1.1.1 $, $Date: 2010-10-16 00:03:49 $
作成者:
佐藤隆之.

フィールドの概要
 
インタフェース ts.util.resource.Resource から継承されたフィールド
EMPTY
 
コンストラクタの概要
  PropertyResource()
          デフォルトコンストラクタ。
protected PropertyResource(PropertyResource res)
          コピーコンストラクタ。
  PropertyResource(java.lang.String path)
          プロパティファイルを引数にとるコンストラクタ。
 
メソッドの概要
protected  DefaultResource createResource()
          このオブジェクトと同じクラスのリソースオブジェクトを作成する。
protected  void load(java.io.InputStream stream)
          引数の入力ストリームからリソースファイルの内容を読み込む。
 void save(java.io.OutputStream stream)
          引数の出力ストリームに、このオブジェクトが保持している内容を保存する。
 
クラス ts.util.resource.DefaultResource から継承されたメソッド
findAllElements, findFirstElement, findOrCreateFirstElement, findOrCreateFirstElement, getAttributes, getBaseElement, getBaseElementName, getChildren, getFirstAttribute, getFirstChild, getFirstValue, getOrCreateFirstChild, getRootElement, getValues, removeChildren, renew, setFirstValue
 
クラス ts.util.resource.AbstractResource から継承されたメソッド
attributeMatchMark, attributeParenthesis, attributeSeparator, elementSeparator, getAttributeMatchMark, getAttributeParenthesis, getAttributeSeparator, getElementSeparator, getInputStream, getNameOfKeyElement, getOutputStream, getPath, listAttributesOfKeyElement, load, save, setAttributeMatchMark, setAttributeMatchMark, setAttributeParenthesis, setAttributeParenthesis, setAttributeSeparator, setAttributeSeparator, setElementSeparator, setElementSeparator, splitKey
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

PropertyResource

public PropertyResource()
デフォルトコンストラクタ。


PropertyResource

public PropertyResource(java.lang.String path)
                 throws java.io.FileNotFoundException,
                        java.io.IOException
プロパティファイルを引数にとるコンストラクタ。

パラメータ:
path - プロパティファイルのパス。
例外:
java.io.FileNotFoundException - 指定したパスのファイルが見つからない場合。
java.io.IOException - ファイルの入出力中に例外が発生した場合。

PropertyResource

protected PropertyResource(PropertyResource res)
コピーコンストラクタ。

パラメータ:
res - コピー元のプロパティリソースオブジェクト。
例外:
java.lang.AssertionError - 引数がヌルの場合(デバッグモードのみ)。
メソッドの詳細

createResource

protected DefaultResource createResource()
このオブジェクトと同じクラスのリソースオブジェクトを作成する。

定義:
クラス DefaultResource 内の createResource
戻り値:
このオブジェクトと同じクラスのリソースオブジェクト。

load

protected void load(java.io.InputStream stream)
             throws java.io.IOException
引数の入力ストリームからリソースファイルの内容を読み込む。

定義:
クラス AbstractResource 内の load
パラメータ:
stream - 入力ストリーム。
例外:
java.io.IOException - 読み込み中に例外が発生した場合。
java.lang.AssertionError - 引数がヌルの場合(デバッグモードのみ)。

save

public void save(java.io.OutputStream stream)
          throws java.io.IOException
引数の出力ストリームに、このオブジェクトが保持している内容を保存する。

定義:
クラス AbstractResource 内の save
パラメータ:
stream - 出力ストリーム。
例外:
java.io.IOException - ファイルの保存中に例外が発生した場合。
java.lang.AssertionError - 引数がヌルの場合(デバッグモードのみ)。


Copyright (C) SATOH Takayuki All Rights Reserved.