Skip to content

Instantly share code, notes, and snippets.

@shurup312
Created May 30, 2013 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shurup312/6aa35dcc7c2c65d2fd21 to your computer and use it in GitHub Desktop.
Save shurup312/6aa35dcc7c2c65d2fd21 to your computer and use it in GitHub Desktop.
package com.tap4fun.spartanwar.utils.network;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.util.zip.GZIPInputStream;
class a extends Thread
{
a(ExtHttpConnection paramExtHttpConnection, String paramString)
{
super(paramString);
}
public void run()
{
int i;
InputStream localInputStream;
try
{
ExtHttpConnection.a(this.a).connect();
if ((ExtHttpConnection.a(this.a).getDoOutput()) && (ExtHttpConnection.b(this.a).length() > 0))
{
BufferedWriter localBufferedWriter = new BufferedWriter(new OutputStreamWriter(ExtHttpConnection.a(this.a).getOutputStream(), "UTF-8"));
localBufferedWriter.write(ExtHttpConnection.b(this.a));
localBufferedWriter.close();
}
i = ExtHttpConnection.a(this.a).getContentLength();
if (i <= 0);
ExtHttpConnection.a(this.a, ExtHttpConnection.a(this.a).getResponseCode());
if (ExtHttpConnection.a(this.a).getHeaderField("Set-Cookie") != null)
ExtHttpConnection.c().a(ExtHttpConnection.a(this.a));
localInputStream = ExtHttpConnection.a(this.a).getInputStream();
if (localInputStream == null)
throw new RuntimeException("Connection Content Null");
}
catch (Exception localException)
{
if (!ExtHttpConnection.d(this.a))
{
ExtHttpConnection.e(this.a);
if (ExtHttpConnection.f(this.a))
ExtHttpConnection.a(this.a, localException.getMessage());
}
com.tap4fun.spartanwar.utils.system.a.a("ExtHttpConnection", localException);
return;
}
String str = ExtHttpConnection.a(this.a).getContentEncoding();
if ((str != null) && (str.toLowerCase().contains("gzip")));
for (Object localObject = new GZIPInputStream(localInputStream); ; localObject = localInputStream)
{
BufferedInputStream localBufferedInputStream = new BufferedInputStream((InputStream)localObject);
switch (e.a[ExtHttpConnection.c(this.a).ordinal()])
{
case 1:
ExtHttpConnection.b(this.a, i, localBufferedInputStream);
return;
case 2:
ExtHttpConnection.a(this.a, i, localBufferedInputStream);
return;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment