|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectto.tetramorph.util.FileTools
public class FileTools
設定プロパティファイルなどのリソースを取得して返すメソッド群からなる。 2011-07-28 ロガーを使うように修正。
メソッドの概要 | |
---|---|
static boolean |
loadProperties(Properties properties,
File file)
fileで指定されたプロパティファイルからデータをpropertiesにロードする。 |
static boolean |
loadProperties(Properties properties,
InputStream inputStream)
inputStreamからXML形式のプロパティファイルをロードする。 |
static StringBuilder |
loadText(InputStream stream,
String charset)
入力ストリームからテキストを読みこむ。 |
static boolean |
saveProperties(Properties properties,
File file,
String comment)
指定されたpropertiesの内容を指定されたfileに、XMLフォーマット(UTF-8)で セーブする。 |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
メソッドの詳細 |
---|
public static boolean loadProperties(Properties properties, File file)
properties
- データをロードしたいProperitesオブジェクトfile
- ロードするファイルオブジェクト。
public static boolean loadProperties(Properties properties, InputStream inputStream)
properties
- このプロパティにデータがロードされる。inputStream
- プロパティの入力ストリーム
public static boolean saveProperties(Properties properties, File file, String comment)
properties
- セーブしたいProperitesオブジェクトfile
- 書き出したいファイルオブジェクト。
ファイル名は"*.properties"とするのが標準的。comment
- プロパティファイル内に書かれる一行コメント。適当なコメント
文字列であればなんでもよい。
public static StringBuilder loadText(InputStream stream, String charset)
InputStream is = Hoge.class.getResourceAsStream("/resources/hoge.txt"); StringBuilder sb = FileTools.loadText(is,"sjis");
stream
- 入力ストリームcharset
- 文字コードセット
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |