iモード携帯電話用Java(iアプリ) Part14at TECH
iモード携帯電話用Java(iアプリ) Part14 - 暇つぶし2ch985:デフォルトの名無しさん
07/08/24 13:19:27
ファイル名を指定してリソースを読み込むメソッド

byte[] loadResFile(String file) {
  byte[] b = null;
  
  DataInputStream dis = null;
  ByteArrayOutputStream out = null;
  try {
    dis = Connector.openDataInputStream("resource:///" + file);
    byte[] buf = new byte[10 * 1024];
    out = new ByteArrayOutputStream(buf.length);
    int ret;
    while ((ret = dis.read(buf)) != -1) {
      out.write(buf, 0, ret);
    }
    b = out.toByteArray();
  } catch (Exception e) {
  } finally {
    try {
      out.close();
    } catch (Exception e) {
    }
    try {
      dis.close();
    } catch (Exception e) {
    }
  }

  return b;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch