iモード携帯電話用Jav ..
[2ch|▼Menu]
985:デフォルトの名無しさん
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

4209日前に更新/254 KB
担当:undef