質問失礼します。Javaヒープより大きいJarファイルを読もうとして、以下のようにしてみたのですが
動きません。このやり方ではまずいですか
JarReader(String name) {
int jsize;
int offset = 0;
int size;
byte[] data = new byte[20480];
HttpConnection c = null;
InputStream in = null;
OutputStream out = null;
in= Connector.openInputStream("scratchpad:///0");
jsize = in.read() * 256 + in.read();
in.close();
if(jsize == 0) {
c = (HttpConnection)Connector.open(
IApplication.getCurrentApp().getSourceURL() + name,
Connector.READ, true);
c.setRequestMethod(HttpConnection.GET);
c.connect();
in = c.openInputStream();
out = Connector.openOutputStream("scratchpad:///0;pos=0");
out.write(jsize/256);
out.write(jsize%256);
while((size = in.read(data, offset, data.length)) != -1) {
out.write(data);
offset += size;
}
in.close();
c.close();
out.close();
}