这个错误是什么意思?
以下是我的 logcat 输出:
01-23 17:09:29.120: W/System.err(24339): java.io.EOFException
01-23 17:09:29.120: W/System.err(24339): at libcore.io.Streams.readAsciiLine(Streams.java:203)
01-23 17:09:29.120: W/System.err(24339): at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:544)
01-23 17:09:29.120: W/System.err(24339): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:784)
01-23 17:09:29.120: W/System.err(24339): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
01-23 17:09:29.120: W/System.err(24339): at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:168)
01-23 17:09:29.130: W/System.err(24339): at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:270)
01-23 17:09:29.130: W/System.err(24339): at com.sfcca.coverflow.Store$downloadMagazine.doInBackground(Store.java:881)
01-23 17:09:29.130: W/System.err(24339): at com.sfcca.coverflow.Store$downloadMagazine.doInBackground(Store.java:1)
01-23 17:09:29.130: W/System.err(24339): at android.os.AsyncTask$2.call(AsyncTask.java:264)
01-23 17:09:29.130: W/System.err(24339): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
01-23 17:09:29.130: W/System.err(24339): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
01-23 17:09:29.130: W/System.err(24339): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
01-23 17:09:29.130: W/System.err(24339): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
01-23 17:09:29.130: W/System.err(24339): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
01-23 17:09:29.130: W/System.err(24339): at java.lang.Thread.run(Thread.java:856)
根据 logcat,这是代码的一部分,其中存在错误:我正在尝试从服务器检索图像 url,然后下载它们
try {
HttpURLConnection conn = (HttpURLConnection) myFileUrl.openConnection();
conn.setDoInput(true);
conn.connect();
InputStream in = conn.getInputStream();
Log.i("im connected", "Download");
bmImg = BitmapFactory.decodeStream(in);
File filename;
try {
// GET EXTERNAL STORAGE, SAVE FILE THERE
File storagePath = new File(Environment.getExternalStorageDirectory(),"/Futsing/issue"+issueNumber+"/");
storagePath.mkdirs();
filename = new File(storagePath + "/page"+number+".jpg");
FileOutputStream out = new FileOutputStream(filename);
bmImg.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
out.close();
in.close();
MediaStore.Images.Media.insertImage(getContentResolver(),filename.getAbsolutePath(), filename.getName(),
filename.getName());
// displayImage();
} catch (Exception e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}