ファイル「http://www.example.com/123.aes」のURLがあります (2MBを超えるmp3ファイルのデータが含まれています)。今、私はこのURLからデータをフェッチしたいと思います。http接続を試みてデータを取得しようとすると、エラーが表示されます-要求されたエンティティが大きすぎます。この問題を解決する方法は?私のコードを以下に示します-
try {
HttpConnection httpConn = (HttpConnection) Connector.open(httpURL, Connector.READ, true);
final int iResponseCode = httpConn.getResponseCode();
Dialog.alert(iResponseCode+"");
InputStream is = httpConn.openInputStream();
byte[] data = net.rim.device.api.io.IOUtilities.streamToBytes(is);
String result = new String(data);
Dialog.alert(result);
FileConnection conn = (FileConnection)Connector.open("file:///store/home/user/pictures/"+System.currentTimeMillis()+".mp3", Connector.READ_WRITE);
conn.create();
OutputStream out = conn.openOutputStream();
out.write(data);
out.flush();
out.close();
conn.close();
} catch (IOException e) {
Dialog.alert(e+"");
}
また、電話のメモリにmp3ファイルとして保存したいと思います。