S
samarek
Fortgeschrittenes Mitglied
- 2
Hi,
ich hab folgendes Problem und zwar versuche ich von einer URL eine GZip Datei als InputStream zu laden.
Die GZip Datei wurde mit php erstellt, sollte also ein Standardformat sein, bin mir aber nicht 100% sicher dass das ein brauchbares Format.
Hier mal die Methode
Der else-Zweig (also ungeGZipped) funktioniert ohne Probleme, aber auf dem anderen Zweig bekomme ich diesen Fehler
versteht das jemand? hat da jemand Erfahrung mit?
ich hab folgendes Problem und zwar versuche ich von einer URL eine GZip Datei als InputStream zu laden.
Die GZip Datei wurde mit php erstellt, sollte also ein Standardformat sein, bin mir aber nicht 100% sicher dass das ein brauchbares Format.
Hier mal die Methode
Code:
public static InputStream getJsonStream(String url, boolean gzip)
{
try
{
HttpGet httpGet = new HttpGet(url);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httpGet);
if (gzip)
{
response.addHeader("Accept-Encoding", "gzip");
content = new GZIPInputStream(response.getEntity().getContent());
Log.v("### GZIP-Stream ###", url);
}
else
{
content = response.getEntity().getContent();
}
}
catch (Exception exc)
{
Log.v("### Exception ###", "Fehler beim Lesen der List JSON", exc);
}
return content;
}
Code:
### Exception ###(13186): Fehler beim Lesen der List JSON
### Exception ###(13186): java.io.IOException: unknown format (magic number a5b)
### Exception ###(13186): at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:84)
### Exception ###(13186): at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:64)
### Exception ###(13186): at kommunikation.Server.getJsonStream(Server.java:66)
### Exception ###(13186): at kommunikation.Json.jsonLaden(Json.java:289)
### Exception ###(13186): at kommunikation.Json.access$1(Json.java:265)
### Exception ###(13186): at kommunikation.Json$AvailabilityTask.doInBackground(Json.java:208)
### Exception ###(13186): at kommunikation.Json$AvailabilityTask.doInBackground(Json.java:1)
### Exception ###(13186): at android.os.AsyncTask$2.call(AsyncTask.java:185)
### Exception ###(13186): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
### Exception ###(13186): at java.util.concurrent.FutureTask.run(FutureTask.java:138)
### Exception ###(13186): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
### Exception ###(13186): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
### Exception ###(13186): at java.lang.Thread.run(Thread.java:1019)