com.hamaf.hikyaku.util
クラス ComUtils

java.lang.Object
  上位を拡張 com.hamaf.hikyaku.util.ComUtils

public class ComUtils
extends java.lang.Object

タイトル:ComUtils is Common Utility Class.

説明:共通ユーティリティクラスです。 以下の機能があります。


全て staticメソッドとして定義されています。
  1. 相対パスから絶対パスに変換する
  2. Windowsクライアントからの送信データの変換
  3. UNICODEのSUN --> Windows code へ変換
  4. UNIX系クライアントからの送信データ変換
  5. Tag文字のEntity参照文字への変換(タグ文字の無効化)

著作権: Copyright (c) 2003/12/01

バージョン:
1.0
作成者:
Hamanaka

コンストラクタの概要
ComUtils()
           
 
メソッドの概要
static boolean checkFIleSize(java.lang.String fs)
          Describe checkFIleSize method : check File size String.
static java.lang.String convertFileSize(long sz)
          Describe convertFileSize method : convert file size long to String.
static long convertFileSize(java.lang.String fs)
          Describe convertFileSize method : convert file size String to long.
static java.lang.String convertSjis(java.lang.String parm)
          Describe convertSjis method : Convert Windows send data to JIS.
static java.lang.String convPath(java.lang.String path, boolean endSep)
          Describe convPath method : convert environment variable.
static java.lang.String filter(java.lang.String str)
          Describe filter method : conver tag charcter.
static java.io.InputStream getResource(java.lang.String fnm)
          Describe getResource method : get resource.
static java.lang.String sun2win(java.lang.String s)
          Describe sun2win method : SUN unicode to Windows unicode.
static java.lang.String sun2win(java.lang.String s, java.lang.String charCd)
          Describe sun2win method : SUN unicode to Windows unicode.
static java.lang.String whichFile(java.lang.String fileName)
          Describe whichFile method : Change Full Path from file.
static java.lang.String win2sun(java.lang.String s)
          Describe win2sun method : Windows unicode to SUN unicode.
static java.lang.String win2sun(java.lang.String s, java.lang.String charCd)
          Describe win2sun method : Windows unicode to SUN unicode.
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ComUtils

public ComUtils()
メソッドの詳細

convPath

public static final java.lang.String convPath(java.lang.String path,
                                              boolean endSep)
Describe convPath method : convert environment variable.
パス名の"${...}"の文字列を環境変数で置換する。

パラメータ:
path - a String : 変換するパス名
戻り値:
a String : 変換後のパス名

getResource

public static final java.io.InputStream getResource(java.lang.String fnm)
Describe getResource method : get resource.
リソースまたはファイルから InputStream を取得する。

パラメータ:
fnm - a String : リソース名
戻り値:
a InputStream : 取得したInputStream

whichFile

public static final java.lang.String whichFile(java.lang.String fileName)
                                        throws java.io.FileNotFoundException,
                                               java.io.UnsupportedEncodingException
Describe whichFile method : Change Full Path from file.
相対パスを絶対パスに変換する。

パラメータ:
fileName - a String : 相対パスで示されたファイル名
戻り値:
a String : 絶対パスに変換した文字列
例外:
java.io.FileNotFoundException - : ファイルが存在しません
java.io.UnsupportedEncodingException - : システムプロパティの file.encoding が取得できません

convertSjis

public static final java.lang.String convertSjis(java.lang.String parm)
                                          throws java.io.UnsupportedEncodingException
Describe convertSjis method : Convert Windows send data to JIS.
Windowsクライアントから送信されたデータをJava用のJISコードに変換して戻す。
送信データに日本語は含まれる場合は、そのままでは文字化けをします。

パラメータ:
parm - a String : 送信されて生きたデータ
戻り値:
a String : 変換後のデータ
例外:
java.io.UnsupportedEncodingException - if an error occurs

sun2win

public static final java.lang.String sun2win(java.lang.String s)
Describe sun2win method : SUN unicode to Windows unicode.
UNICODE変換におけるMicrosoftとSUNのコードの違いを変換します。
SUN --> Windows code へ変換する。

パラメータ:
s - a String : 変換前の文字列
戻り値:
a String : 変換後の文字列

sun2win

public static final java.lang.String sun2win(java.lang.String s,
                                             java.lang.String charCd)
Describe sun2win method : SUN unicode to Windows unicode.
web.xmlの文字コード(<param-name>CharCode)がShift_JISの場合に、
UNICODE変換におけるMicrosoftとSUNのコードの違いを変換します。

パラメータ:
s - a String : 変換前の文字列
charCd - a String : characte encording
戻り値:
a String : 変換後の文字列

win2sun

public static final java.lang.String win2sun(java.lang.String s)
Describe win2sun method : Windows unicode to SUN unicode.
UNICODE変換におけるMicrosoftとSUNのコードの違いを変換します。
Windows --> SUN code へ変換する。

パラメータ:
s - a String : 変換前の文字列
戻り値:
a String : 変換後の文字列

win2sun

public static final java.lang.String win2sun(java.lang.String s,
                                             java.lang.String charCd)
Describe win2sun method : Windows unicode to SUN unicode.
web.xmlの文字コード(<param-name>CharCode)がShift_JISの場合に、
UNICODE変換におけるMicrosoftとSUNのコードの違いを変換します。

パラメータ:
s - a String : 変換前の文字列
charCd - a String : characte encording
戻り値:
a String : 変換後の文字列

filter

public static final java.lang.String filter(java.lang.String str)
Describe filter method : conver tag charcter.
クロスサイトスクリプティング問題への対応(おまじない)
TAG文字(<,>,&)を無効にして処理結果表示の際の安全性を確保します
空白( )はIEでエンティティ文字への変換を行わないため中止する。2006/12/06

パラメータ:
str - a String :
戻り値:
a String :

checkFIleSize

public static final boolean checkFIleSize(java.lang.String fs)
Describe checkFIleSize method : check File size String.
ファイルサイズの指定文字列をチェックする
整数3桁または整数2桁と小数1桁の数字とK,M,G指定の場合ノーマルとする。

パラメータ:
fs - a String : チェックする文字列
戻り値:
a boolean : エラーのとき true

convertFileSize

public static final long convertFileSize(java.lang.String fs)
Describe convertFileSize method : convert file size String to long.
ファイルサイズ文字列(xxxK, xxxM, xxxG)をバイト数に変換する。
nnK -> nn * 1024, nnM -> nn* 1024 * 1024 を戻す

パラメータ:
fs - a String : ファイルサイズの文字列
戻り値:
a long : 変換後のバイト数

convertFileSize

public static final java.lang.String convertFileSize(long sz)
Describe convertFileSize method : convert file size long to String.
ファイルサイズのバイト数を文字列(xxxK, xxxM, xxxG)に変換する。

パラメータ:
fs - a long : ファイルサイズ
戻り値:
a String : 変換後の文字列