- 985 名前:デフォルトの名無しさん mailto:sage [2007/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; }
|

|