public class DefaultPropertiesPersister extends ObjectSE implements PropertiesPersister
PropertiesPersister
インターフェースのデフォルトの実装。java.util.Properties
のネイティブ解析に従います。 プロパティファイルの文字セットを指定するなど、任意のリーダーからの読み取りと任意のライターへの書き込みを可能にします。これは、残念ながら JDK5 までは標準の java.util.Properties
にはなかった機能です。ISO-8859-1 文字セットを使用してのみファイルをロードできました。
ストリームからのロードとストリームへの保存は、それぞれ Properties.load
と Properties.store
に委譲され、JDK プロパティクラスによって実装される Unicode 変換と完全に互換性があります。JDK 6 以降、Properties.load/store
はリーダー / ライターにも使用され、このクラスを単純な下位互換性アダプターに効果的に変換します。
Reader/Writer で動作する永続コードは JDK の解析戦略に従いますが、Unicode 変換は実装しません。これは、Reader/Writer がすでに適切な文字のデコード / エンコードを適用している必要があるためです。プロパティファイルで Unicode 文字をエスケープする場合は、Reader/Writer のエンコードを指定しないでください (ReloadableResourceBundleMessageSource の "defaultEncoding" および "fileEncodings" プロパティなど)。
Properties
SE, Properties.load(java.io.Reader)
SE, Properties.store(java.io.Writer, java.lang.String)
SEコンストラクターと説明 |
---|
DefaultPropertiesPersister() |
修飾子と型 | メソッドと説明 |
---|---|
void | load(PropertiesSE props, InputStreamSE is) 指定された InputStream から指定された Properties オブジェクトにプロパティをロードします。 |
void | load(PropertiesSE props, ReaderSE reader) 指定された Reader から指定された Properties オブジェクトにプロパティをロードします。 |
void | loadFromXml(PropertiesSE props, InputStreamSE is) 指定された XML InputStream から指定された Properties オブジェクトにプロパティをロードします。 |
void | store(PropertiesSE props, OutputStreamSE os, StringSE header) 与えられた Properties オブジェクトの内容を与えられた OutputStream に書き込みます。 |
void | store(PropertiesSE props, WriterSE writer, StringSE header) 指定された Properties オブジェクトの内容を指定された Writer に書き込みます。 |
void | storeToXml(PropertiesSE props, OutputStreamSE os, StringSE header) 指定された Properties オブジェクトの内容を指定された XML OutputStream に書き込みます。 |
void | storeToXml(PropertiesSE props, OutputStreamSE os, StringSE header, StringSE encoding) 指定された Properties オブジェクトの内容を指定された XML OutputStream に書き込みます。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSE
public void load(PropertiesSE props, InputStreamSE is) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の load
props
- ロードする Properties オブジェクト is
- ロードする InputStreamIOExceptionSE
- I/O エラーの場合 Properties.load(java.io.Reader)
SEpublic void load(PropertiesSE props, ReaderSE reader) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の load
props
- ロードする Properties オブジェクト reader
- ロードするリーダー IOExceptionSE
- I/O エラーの場合 public void store(PropertiesSE props, OutputStreamSE os, StringSE header) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の store
props
- 保存する Properties オブジェクト os
- 書き込む OutputStreamheader
- プロパティリストの説明 IOExceptionSE
- I/O エラーの場合 Properties.store(java.io.Writer, java.lang.String)
SEpublic void store(PropertiesSE props, WriterSE writer, StringSE header) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の store
props
- 保存する Properties オブジェクト writer
- 書き込むライター header
- プロパティリストの説明 IOExceptionSE
- I/O エラーの場合 public void loadFromXml(PropertiesSE props, InputStreamSE is) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の loadFromXml
props
- ロードする Properties オブジェクト is
- ロードする InputStreamIOExceptionSE
- I/O エラーの場合 Properties.loadFromXML(java.io.InputStream)
SEpublic void storeToXml(PropertiesSE props, OutputStreamSE os, StringSE header) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の storeToXml
props
- 保存する Properties オブジェクト os
- 書き込む OutputStreamheader
- プロパティリストの説明 IOExceptionSE
- I/O エラーの場合 Properties.storeToXML(java.io.OutputStream, String)
SEpublic void storeToXml(PropertiesSE props, OutputStreamSE os, StringSE header, StringSE encoding) throws IOExceptionSE
PropertiesPersister
PropertiesPersister
の storeToXml
props
- 保存する Properties オブジェクト os
- 書き込む OutputStreamheader
- プロパティリストの説明 encoding
- 使用するエンコーディング IOExceptionSE
- I/O エラーの場合 Properties.storeToXML(java.io.OutputStream, String, String)
SE