I am trying to fix bug, when some files can't be downloaded. I located that urlConnection = (HttpURLConnection) url.openConnection(); (from code below) sometimes return HttpURLConnection object with connected = false.
However I can't look into as for HttpURLConnectionImpl i get "source not found" in Eclipse
private byte[] getFromHttp(String urlString) {
HttpURLConnection urlConnection = null;
BufferedOutputStream out = null;
FlushedInputStream in = null;
try {
final URL url = new URL(urlString);
urlConnection = (HttpURLConnection) url.openConnection();
InputStream is = urlConnection.getInputStream();
in = new FlushedInputStream(new BufferedInputStream(is, IO_BUFFER_SIZE));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int b;
while ((b = in.read()) != -1) {
baos.write(b);
}
return baos.toByteArray();
} catch (final IOException e) {
Of course I have tried to attach sources for used Android 4.2 (android-17) from my D:\adt-bundle\sdk\sources\android-17. Eclipse-ADT does not take it.
0 comments:
Post a Comment