jp.preserv.util
クラス SecurityUtil

java.lang.Object
  拡張jp.preserv.util.SecurityUtil

public final class SecurityUtil
extends java.lang.Object

セキュリティに関するユーティリティクラスです。
通常アプレットからではアクセス不可能な処理を、 可能とするための機能を提供します。

バージョン:
1.00 H.WAKUI (MCR) 2007/02/16 初版
作成者:
H.WAKUI (MCR)

メソッドの概要
static java.lang.reflect.Field getDeclaredField(java.lang.String name, java.lang.Class clazz)
          フィールドを取得します。
static java.io.FileInputStream getFileInputStream(java.lang.String target)
          ローカルディスクのファイルのファイル入力ストリームを生成します。
static java.io.FileOutputStream getFileOutputStream(java.lang.String target)
          ローカルディスクへのファイル出力ストリームを生成します。
static java.io.BufferedInputStream getInputStream(java.lang.ClassLoader target, java.lang.String in)
          ロード済みリソースの入力ストリームを生成します。
static java.io.BufferedInputStream getInputStream(java.net.URL target)
          リモートファイルの入力ストリームを生成します。
static java.io.BufferedWriter getOutputStream(java.lang.String target, int bufSize)
          ローカルファイルへの出力ストリームを生成します。
static java.lang.String getProperty(java.lang.String key)
          システムプロパティから値を取得します。
static void setAccessible(java.lang.reflect.Field f, boolean b)
          クラスフィールドのアクセス権を変更します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

メソッドの詳細

getFileInputStream

public static java.io.FileInputStream getFileInputStream(java.lang.String target)
                                                  throws java.io.FileNotFoundException
ローカルディスクのファイルのファイル入力ストリームを生成します。

パラメータ:
target - ローカルファイル名
戻り値:
ファイル入力ストリーム
例外:
java.io.FileNotFoundException - ファイルが見つからない場合

getFileOutputStream

public static java.io.FileOutputStream getFileOutputStream(java.lang.String target)
                                                    throws java.io.FileNotFoundException
ローカルディスクへのファイル出力ストリームを生成します。

パラメータ:
target - ローカルファイル名
戻り値:
ファイル出力ストリーム
例外:
java.io.FileNotFoundException - ファイルが見つからない場合

getInputStream

public static java.io.BufferedInputStream getInputStream(java.net.URL target)
                                                  throws java.io.IOException
リモートファイルの入力ストリームを生成します。

パラメータ:
target - URLリモートファイル
戻り値:
リモートファイル入力ストリーム
例外:
java.io.IOException - ファイルアクセス中に例外が発生した場合

getInputStream

public static java.io.BufferedInputStream getInputStream(java.lang.ClassLoader target,
                                                         java.lang.String in)
                                                  throws java.io.IOException
ロード済みリソースの入力ストリームを生成します。

パラメータ:
target - クラスローダ
in - リソースパス
戻り値:
リソースファイル入力ストリーム
例外:
java.io.IOException - リソースアクセス中に例外が発生した場合

getOutputStream

public static java.io.BufferedWriter getOutputStream(java.lang.String target,
                                                     int bufSize)
                                              throws java.io.IOException
ローカルファイルへの出力ストリームを生成します。

パラメータ:
target - ファイル名
bufSize - 出力バッファサイズ
戻り値:
ローカルファイル出力ストリーム
例外:
java.io.IOException - ファイルアクセス中に例外が発生した場合

getProperty

public static java.lang.String getProperty(java.lang.String key)
                                    throws java.lang.Exception
システムプロパティから値を取得します。

パラメータ:
key - システムプロパティのキー
戻り値:
システムプロパティの値
例外:
java.lang.Exception - システムプロパティにアクセスする権限がない場合

setAccessible

public static void setAccessible(java.lang.reflect.Field f,
                                 boolean b)
                          throws java.lang.Exception
クラスフィールドのアクセス権を変更します。

パラメータ:
f - 変更対象とするクラスフィールド
b - アクセス権
例外:
java.lang.Exception - クラスフィールドのアクセス権を変更する権限がない場合

getDeclaredField

public static java.lang.reflect.Field getDeclaredField(java.lang.String name,
                                                       java.lang.Class clazz)
                                                throws java.lang.Exception
フィールドを取得します。

パラメータ:
name - 取得対象とするフィールド名
clazz - 取得対象のフィールドをもつクラス
戻り値:
フィールド
例外:
java.lang.Exception - 指定クラスからフィールドを取得する権限がない場合