Comparing sensitive data, confidential files or internal emails?

Most legal and privacy policies prohibit uploading sensitive data online. Diffchecker Desktop ensures your confidential information never leaves your computer. Work offline and compare documents securely.

Untitled diff

Created Diff never expires
286 removals
689 lines
309 additions
709 lines
package com.nianticlabs.nia.network;
package com.nianticlabs.nia.network;


import android.util.Log;
import android.util.Log;
import java.net.HttpURLConnection;
import java.net.HttpURLConnection;
import java.nio.ByteBuffer;
import java.nio.ByteBuffer;
import java.text.ParseException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Date;
import java.util.HashSet;
import java.util.HashSet;
import java.util.Set;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeUnit;


public class NiaNet
public class NiaNet
{
{
private static final int CHUNK_SIZE = 32768;
private static final int CHUNK_SIZE = 32768;
private static final int HTTP_BAD_REQUEST = 400;
private static final int HTTP_BAD_REQUEST = 400;
private static final int HTTP_OK = 200;
private static final int HTTP_OK = 200;
private static final String IF_MODIFIED_SINCE = "If-Modified-Since";
private static final String IF_MODIFIED_SINCE = "If-Modified-Since";
private static final int METHOD_DELETE = 4;
private static final int METHOD_DELETE = 4;
private static final int METHOD_GET = 0;
private static final int METHOD_GET = 0;
private static final int METHOD_HEAD = 1;
private static final int METHOD_HEAD = 1;
private static final int METHOD_OPTIONS = 5;
private static final int METHOD_OPTIONS = 5;
private static final int METHOD_POST = 2;
private static final int METHOD_POST = 2;
private static final int METHOD_PUT = 3;
private static final int METHOD_PUT = 3;
private static final int METHOD_TRACE = 6;
private static final int METHOD_TRACE = 6;
private static final int NETWORK_TIMEOUT_MS = 15000;
private static final int NETWORK_TIMEOUT_MS = 15000;
private static final int POOL_THREAD_NUM = 6;
private static final int POOL_THREAD_NUM = 6;
private static final String TAG = "NiaNet";
private static final String TAG = "NiaNet";
private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(6, 12, 5L, TimeUnit.SECONDS, new LinkedBlockingQueue());
private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(6, 12, 5L, TimeUnit.SECONDS, new LinkedBlockingQueue());
private static Set<Integer> pendingRequestIds = new HashSet();
private static Set<Integer> pendingRequestIds = new HashSet();
static ThreadLocal<ByteBuffer> readBuffer = new ThreadLocal()
static ThreadLocal<ByteBuffer> readBuffer = new ThreadLocal()
{
{
protected ByteBuffer initialValue()
protected ByteBuffer initialValue()
{
{
return ByteBuffer.allocateDirect(32768);
return ByteBuffer.allocateDirect(32768);
}
}
};
};
private static final ThreadLocal<byte[]> threadChunk = new ThreadLocal()
private static final ThreadLocal<byte[]> threadChunk = new ThreadLocal()
{
{
protected byte[] initialValue()
protected byte[] initialValue()
{
{
return new byte[32768];
return new byte[32768];
}
}
};
};
public static void cancel(int paramInt)
public static void cancel(int paramInt)
{
{
synchronized (pendingRequestIds)
synchronized (pendingRequestIds)
{
{
pendingRequestIds.remove(Integer.valueOf(paramInt));
pendingRequestIds.remove(Integer.valueOf(paramInt));
return;
return;
}
}
}
}
/* Error */
/* Error */
private static void doSyncRequest(long paramLong, int paramInt1, String paramString1, int paramInt2, String paramString2, ByteBuffer paramByteBuffer, int paramInt3, int paramInt4)
private static void doSyncRequest(long paramLong, int paramInt1, String paramString1, int paramInt2, String paramString2, ByteBuffer paramByteBuffer, int paramInt3, int paramInt4)
{
{
// Byte code:
// Byte code:
// 0: getstatic 78 com/nianticlabs/nia/network/NiaNet:pendingRequestIds Ljava/util/Set;
// 0: getstatic 78 com/nianticlabs/nia/network/NiaNet:pendingRequestIds Ljava/util/Set;
// 3: astore 10
// 3: astore 10
// 5: aload 10
// 5: aload 10
// 7: monitorenter
// 7: monitorenter
// 8: getstatic 78 com/nianticlabs/nia/network/NiaNet:pendingRequestIds Ljava/util/Set;
// 8: getstatic 78 com/nianticlabs/nia/network/NiaNet:pendingRequestIds Ljava/util/Set;
// 11: iload_2
// 11: iload_2
// 12: invokestatic 99 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 12: invokestatic 99 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 15: invokeinterface 110 2 0
// 15: invokeinterface 110 2 0
// 20: ifne +569 -> 589
// 20: ifne +587 -> 607
// 23: iconst_1
// 23: iconst_1
// 24: istore 9
// 24: istore 9
// 26: iload 9
// 26: iload 9
// 28: ifeq +7 -> 35
// 28: ifeq +7 -> 35
// 31: aload 10
// 31: aload 10
// 33: monitorexit
// 33: monitorexit
// 34: return
// 34: return
// 35: getstatic 78 com/nianticlabs/nia/network/NiaNet:pendingRequestIds Ljava/util/Set;
// 35: getstatic 78 com/nianticlabs/nia/network/NiaNet:pendingRequestIds Ljava/util/Set;
// 38: iload_2
// 38: iload_2
// 39: invokestatic 99 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 39: invokestatic 99 java/lang/Integer:valueOf (I)Ljava/lang/Integer;
// 42: invokeinterface 105 2 0
// 42: invokeinterface 105 2 0
// 47: pop
// 47: pop
// 48: aload 10
// 48: aload 10
// 50: monitorexit
// 50: monitorexit
// 51: aconst_null
// 51: aconst_null
// 52: astore 12
// 52: astore 12
// 54: aconst_null
// 54: aconst_null
// 55: astore 11
// 55: astore 11
// 57: sipush 400
// 57: sipush 400
// 60: istore 9
// 60: istore 9
// 62: aconst_null
// 62: aconst_null
// 63: astore 13
// 63: astore 13
// 65: iload 9
// 65: iload 9
// 67: istore_2
// 67: istore_2
// 68: aload 13
// 68: aload 13
// 70: astore 10
// 70: astore 10
// 72: new 112 java/net/URL
// 72: new 112 java/net/URL
// 75: dup
// 75: dup
// 76: aload_3
// 76: aload_3
// 77: invokespecial 115 java/net/URL:<init> (Ljava/lang/String;)V
// 77: invokespecial 115 java/net/URL:<init> (Ljava/lang/String;)V
// 80: invokevirtual 119 java/net/URL:openConnection ()Ljava/net/URLConnection;
// 80: invokevirtual 119 java/net/URL:openConnection ()Ljava/net/URLConnection;
// 83: checkcast 121 java/net/HttpURLConnection
// 83: checkcast 121 java/net/HttpURLConnection
// 86: checkcast 121 java/net/HttpURLConnection
// 86: checkcast 121 java/net/HttpURLConnection
// 89: astore_3
// 89: astore_3
// 90: iload 9
// 90: iload 9
// 92: istore_2
// 92: istore_2
// 93: aload 13
// 93: aload 13
// 95: astore 10
// 95: astore 10
// 97: aload_3
// 97: aload_3
// 98: astore 11
// 98: astore 11
// 100: aload_3
// 100: aload_3
// 101: astore 12
// 101: astore 12
// 103: aload_3
// 103: aload_3
// 104: aload 5
// 104: aload 5
// 106: invokestatic 125 com/nianticlabs/nia/network/NiaNet:setHeaders (Ljava/net/HttpURLConnection;Ljava/lang/String;)V
// 106: invokestatic 125 com/nianticlabs/nia/network/NiaNet:setHeaders (Ljava/net/HttpURLConnection;Ljava/lang/String;)V
// 109: iload 9
// 109: iload 9
// 111: istore_2
// 111: istore_2
// 112: aload 13
// 112: aload 13
// 114: astore 10
// 114: astore 10
// 116: aload_3
// 116: aload_3
// 117: astore 11
// 117: astore 11
// 119: aload_3
// 119: aload_3
// 120: astore 12
// 120: astore 12
// 122: aload_3
// 122: aload_3
// 123: sipush 15000
// 123: sipush 15000
// 126: invokevirtual 128 java/net/HttpURLConnection:setConnectTimeout (I)V
// 126: invokevirtual 128 java/net/HttpURLConnection:setConnectTimeout (I)V
// 129: iload 9
// 129: iload 9
// 131: istore_2
// 131: istore_2
// 132: aload 13
// 132: aload 13
// 134: astore 10
// 134: astore 10
// 136: aload_3
// 136: aload_3
// 137: astore 11
// 137: astore 11
// 139: aload_3
// 139: aload_3
// 140: astore 12
// 140: astore 12
// 142: aload_3
// 142: aload_3
// 143: ldc -126
// 143: ldc -126
// 145: ldc -124
// 145: ldc -124
// 147: invokevirtual 136 java/net/HttpURLConnection:setRequestProperty (Ljava/lang/String;Ljava/lang/String;)V
// 147: invokevirtual 136 java/net/HttpURLConnection:setRequestProperty (Ljava/lang/String;Ljava/lang/String;)V
// 150: iload 9
// 150: iload 9
// 152: istore_2
// 152: istore_2
// 153: aload 13
// 153: aload 13
// 155: astore 10
// 155: astore 10
// 157: aload_3
// 157: aload_3
// 158: astore 11
// 158: astore 11
// 160: aload_3
// 160: aload_3
// 161: astore 12
// 161: astore 12
// 163: iconst_0
// 163: iconst_0
// 164: invokestatic 140 java/net/HttpURLConnection:setFollowRedirects (Z)V
// 164: invokestatic 140 java/net/HttpURLConnection:setFollowRedirects (Z)V
// 167: iload 9
// 167: iload 9
// 169: istore_2
// 169: istore_2
// 170: aload 13
// 170: aload 13
// 172: astore 10
// 172: astore 10
// 174: aload_3
// 174: aload_3
// 175: astore 11
// 175: astore 11
// 177: aload_3
// 177: aload_3
// 178: astore 12
// 178: astore 12
// 180: aload_3
// 180: lload_0
// 181: iload 4
// 181: aload_3
// 183: invokestatic 144 com/nianticlabs/nia/network/NiaNet:getMethodString (I)Ljava/lang/String;
// 182: invokestatic 144 com/nianticlabs/nia/network/NiaNet:nativeSetupConnection (JLjava/net/HttpURLConnection;)V
// 186: invokevirtual 147 java/net/HttpURLConnection:setRequestMethod (Ljava/lang/String;)V
// 185: iload 9
// 189: aload 6
// 187: istore_2
// 191: ifnull +91 -> 282
// 188: aload 13
// 194: iload 8
// 190: astore 10
// 196: ifle +86 -> 282
// 192: aload_3
// 199: iload 9
// 193: astore 11
// 201: istore_2
// 195: aload_3
// 202: aload 13
// 196: astore 12
// 204: astore 10
// 198: aload_3
// 206: aload_3
// 199: iload 4
// 207: astore 11
// 201: invokestatic 148 com/nianticlabs/nia/network/NiaNet:getMethodString (I)Ljava/lang/String;
// 209: aload_3
// 204: invokevirtual 151 java/net/HttpURLConnection:setRequestMethod (Ljava/lang/String;)V
// 210: astore 12
// 207: aload 6
// 212: aload_3
// 209: ifnull +91 -> 300
// 213: iconst_1
// 212: iload 8
// 214: invokevirtual 150 java/net/HttpURLConnection:setDoOutput (Z)V
// 214: ifle +86 -> 300
// 217: iload 9
// 217: iload 9
// 219: istore_2
// 219: istore_2
// 220: aload 13
// 220: aload 13
// 222: astore 10
// 222: astore 10
// 224: aload_3
// 224: aload_3
// 225: astore 11
// 225: astore 11
// 227: aload_3
// 227: aload_3
// 228: astore 12
// 228: astore 12
// 230: aload_3
// 230: aload_3
// 231: invokevirtual 154 java/net/HttpURLConnection:getOutputStream ()Ljava/io/OutputStream;
// 231: iconst_1
// 234: astore 5
// 232: invokevirtual 154 java/net/HttpURLConnection:setDoOutput (Z)V
// 236: aload 6
// 235: iload 9
// 238: invokevirtual 160 java/nio/ByteBuffer:hasArray ()Z
// 237: istore_2
// 241: ifeq +163 -> 404
// 238: aload 13
// 244: aload 5
// 240: astore 10
// 246: aload 6
// 242: aload_3
// 248: invokevirtual 164 java/nio/ByteBuffer:array ()[B
// 243: astore 11
// 251: aload 6
// 245: aload_3
// 253: invokevirtual 168 java/nio/ByteBuffer:arrayOffset ()I
// 246: astore 12
// 256: iload 7
// 248: aload_3
// 258: iadd
// 249: invokevirtual 158 java/net/HttpURLConnection:getOutputStream ()Ljava/io/OutputStream;
// 259: iload 8
// 252: astore 5
// 261: invokevirtual 174 java/io/OutputStream:write ([BII)V
// 254: aload 6
// 264: iload 9
// 256: invokevirtual 164 java/nio/ByteBuffer:hasArray ()Z
// 266: istore_2
// 259: ifeq +163 -> 422
// 267: aload 13
// 262: aload 5
// 269: astore 10
// 264: aload 6
// 271: aload_3
// 266: invokevirtual 168 java/nio/ByteBuffer:array ()[B
// 272: astore 11
// 269: aload 6
// 274: aload_3
// 271: invokevirtual 172 java/nio/ByteBuffer:arrayOffset ()I
// 275: astore 12
// 274: iload 7
// 277: aload 5
// 276: iadd
// 279: invokevirtual 177 java/io/OutputStream:close ()V
// 277: iload 8
// 279: invokevirtual 178 java/io/OutputStream:write ([BII)V
// 282: iload 9
// 282: iload 9
// 284: istore_2
// 284: istore_2
// 285: aload 13
// 285: aload 13
// 287: astore 10
// 287: astore 10
// 289: aload_3
// 289: aload_3
// 290: astore 11
// 290: astore 11
// 292: aload_3
// 292: aload_3
// 293: astore 12
// 293: astore 12
// 295: aload_3
// 295: aload 5
// 296: invokevirtual 180 java/net/HttpURLConnection:getResponseCode ()I
// 297: invokevirtual 181 java/io/OutputStream:close ()V
// 299: istore 4
// 300: iload 9
// 301: iload 4
// 302: istore_2
// 303: istore_2
// 303: aload 13
// 304: aload 13
// 305: astore 10
// 306: astore 10
// 307: aload_3
// 308: aload_3
// 308: astore 11
// 309: astore 11
// 310: aload_3
// 311: aload_3
// 311: astore 12
// 312: astore 12
// 313: aload_3
// 314: aload_3
// 314: invokevirtual 184 java/net/HttpURLConnection:getResponseCode ()I
// 315: invokestatic 184 com/nianticlabs/nia/network/NiaNet:joinHeaders (Ljava/net/HttpURLConnection;)Ljava/lang/String;
// 317: istore 4
// 318: astore 5
// 319: iload 4
// 320: iload 4
// 321: istore_2
// 322: istore_2
// 322: aload 13
// 323: aload 5
// 324: astore 10
// 325: astore 10
// 326: aload_3
// 327: aload_3
// 327: astore 11
// 328: astore 11
// 329: aload_3
// 330: aload_3
// 330: astore 12
// 331: astore 12
// 332: aload_3
// 333: aload_3
// 333: invokestatic 188 com/nianticlabs/nia/network/NiaNet:joinHeaders (Ljava/net/HttpURLConnection;)Ljava/lang/String;
// 334: invokestatic 188 com/nianticlabs/nia/network/NiaNet:readDataSteam (Ljava/net/HttpURLConnection;)I
// 336: astore 5
// 337: istore 7
// 338: iload 4
// 339: iload 7
// 340: istore_2
// 341: istore_2
// 341: aload 5
// 342: iload 4
// 343: astore 10
// 344: istore 7
// 345: aload_3
// 346: aload 5
// 346: astore 11
// 348: astore 6
// 348: aload_3
// 350: iload_2
// 349: astore 12
// 351: istore 8
// 351: aload_3
// 353: aload_3
// 352: invokestatic 192 com/nianticlabs/nia/network/NiaNet:readDataSteam (Ljava/net/HttpURLConnection;)I
// 354: ifnull +18 -> 372
// 355: istore 7
// 357: aload_3
// 357: iload 7
// 358: invokevirtual 191 java/net/HttpURLConnection:disconnect ()V
// 359: istore_2
// 361: iload_2
// 360: iload 4
// 362: istore 8
// 362: istore 7
// 364: aload 5
// 364: aload 5
// 366: astore 6
// 366: astore 6
// 368: iload 4
// 368: iload_2
// 370: istore 7
// 369: istore 8
// 372: iload 8
// 371: aload_3
// 374: ifle +203 -> 577
// 372: ifnull +18 -> 390
// 377: lload_0
// 375: aload_3
// 378: iload 7
// 376: invokevirtual 195 java/net/HttpURLConnection:disconnect ()V
// 380: aload 6
// 379: iload_2
// 382: getstatic 84 com/nianticlabs/nia/network/NiaNet:readBuffer Ljava/lang/ThreadLocal;
// 380: istore 8
// 385: invokevirtual 197 java/lang/ThreadLocal:get ()Ljava/lang/Object;
// 382: aload 5
// 388: checkcast 156 java/nio/ByteBuffer
// 384: astore 6
// 391: iconst_0
// 386: iload 4
// 392: iload 8
// 388: istore 7
// 394: invokestatic 201 com/nianticlabs/nia/network/NiaNet:nativeCallback (JILjava/lang/String;Ljava/nio/ByteBuffer;II)V
// 390: iload 8
// 397: return
// 392: ifle +203 -> 595
// 398: astore_3
// 395: lload_0
// 399: aload 10
// 396: iload 7
// 401: monitorexit
// 398: aload 6
// 402: aload_3
// 400: getstatic 84 com/nianticlabs/nia/network/NiaNet:readBuffer Ljava/lang/ThreadLocal;
// 403: athrow
// 403: invokevirtual 201 java/lang/ThreadLocal:get ()Ljava/lang/Object;
// 404: getstatic 81 com/nianticlabs/nia/network/NiaNet:threadChunk Ljava/lang/ThreadLocal;
// 406: checkcast 160 java/nio/ByteBuffer
// 407: invokevirtual 197 java/lang/ThreadLocal:get ()Ljava/lang/Object;
// 409: iconst_0
// 410: checkcast 203 [B
// 410: iload 8
// 413: astore 10
// 412: invokestatic 205 com/nianticlabs/nia/network/NiaNet:nativeCallback (JILjava/lang/String;Ljava/nio/ByteBuffer;II)V
// 415: aload 6
// 415: return
// 417: invokevirtual 206 java/nio/ByteBuffer:hasRemaining ()Z
// 416: astore_3
// 420: ifeq -156 -> 264
// 417: aload 10
// 423: aload 6
// 419: monitorexit
// 425: invokevirtual 209 java/nio/ByteBuffer:remaining ()I
// 420: aload_3
// 428: aload 10
// 421: athrow
// 430: arraylength
// 422: getstatic 81 com/nianticlabs/nia/network/NiaNet:threadChunk Ljava/lang/ThreadLocal;
// 431: invokestatic 215 java/lang/Math:min (II)I
// 425: invokevirtual 201 java/lang/ThreadLocal:get ()Ljava/lang/Object;
// 434: istore_2
// 428: checkcast 207 [B
// 435: aload 6
// 431: astore 10
// 437: aload 10
// 433: aload 6
// 439: iconst_0
// 435: invokevirtual 210 java/nio/ByteBuffer:hasRemaining ()Z
// 440: iload_2
// 438: ifeq -156 -> 282
// 441: invokevirtual 218 java/nio/ByteBuffer:get ([BII)Ljava/nio/ByteBuffer;
// 441: aload 6
// 444: pop
// 443: invokevirtual 213 java/nio/ByteBuffer:remaining ()I
// 445: aload 5
// 446: aload 10
// 447: aload 10
// 448: arraylength
// 449: iconst_0
// 449: invokestatic 219 java/lang/Math:min (II)I
// 450: iload_2
// 452: istore_2
// 451: invokevirtual 174 java/io/OutputStream:write ([BII)V
// 453: aload 6
// 454: goto -39 -> 415
// 455: aload 10
// 457: astore 6
// 457: iconst_0
// 459: iload 9
// 458: iload_2
// 461: istore_2
// 459: invokevirtual 222 java/nio/ByteBuffer:get ([BII)Ljava/nio/ByteBuffer;
// 462: aload 13
// 462: pop
// 464: astore 10
// 463: aload 5
// 466: aload_3
// 465: aload 10
// 467: astore 11
// 467: iconst_0
// 469: aload_3
// 468: iload_2
// 470: astore 12
// 469: invokevirtual 178 java/io/OutputStream:write ([BII)V
// 472: aload 5
// 472: goto -39 -> 433
// 474: invokevirtual 177 java/io/OutputStream:close ()V
// 475: astore 6
// 477: iload 9
// 477: iload 9
// 479: istore_2
// 479: istore_2
// 480: aload 13
// 480: aload 13
// 482: astore 10
// 482: astore 10
// 484: aload_3
// 484: aload_3
// 485: astore 11
// 485: astore 11
// 487: aload_3
// 487: aload_3
// 488: astore 12
// 488: astore 12
// 490: aload 6
// 490: aload 5
// 492: athrow
// 492: invokevirtual 181 java/io/OutputStream:close ()V
// 493: astore_3
// 495: iload 9
// 494: aload 11
// 497: istore_2
// 496: astore 12
// 498: aload 13
// 498: ldc 41
// 500: astore 10
// 500: new 220 java/lang/StringBuilder
// 502: aload_3
// 503: dup
// 503: astore 11
// 504: invokespecial 221 java/lang/StringBuilder:<init> ()V
// 505: aload_3
// 507: ldc -33
// 506: astore 12
// 509: invokevirtual 227 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 508: aload 6
// 512: aload_3
// 510: athrow
// 513: invokevirtual 231 java/io/IOException:getMessage ()Ljava/lang/String;
// 511: astore_3
// 516: invokevirtual 227 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 512: aload 11
// 519: invokevirtual 234 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 514: astore 12
// 522: invokestatic 240 android/util/Log:e (Ljava/lang/String;Ljava/lang/String;)I
// 516: ldc 41
// 525: pop
// 518: new 224 java/lang/StringBuilder
// 526: iconst_0
// 521: dup
// 527: istore 4
// 522: invokespecial 225 java/lang/StringBuilder:<init> ()V
// 529: iload_2
// 525: ldc -29
// 530: istore 7
// 527: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 532: aload 10
// 530: aload_3
// 534: astore 6
// 531: invokevirtual 235 java/io/IOException:getMessage ()Ljava/lang/String;
// 536: iload 4
// 534: invokevirtual 231 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 538: istore 8
// 537: invokevirtual 238 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 540: aload 11
// 540: invokestatic 244 android/util/Log:e (Ljava/lang/String;Ljava/lang/String;)I
// 542: ifnull -170 -> 372
// 543: pop
// 545: aload 11
// 544: iconst_0
// 547: invokevirtual 191 java/net/HttpURLConnection:disconnect ()V
// 545: istore 4
// 550: iload_2
// 547: iload_2
// 551: istore 7
// 548: istore 7
// 553: aload 10
// 550: aload 10
// 555: astore 6
// 552: astore 6
// 557: iload 4
// 554: iload 4
// 559: istore 8
// 556: istore 8
// 561: goto -189 -> 372
// 558: aload 11
// 564: astore_3
// 560: ifnull -170 -> 390
// 565: aload 12
// 563: aload 11
// 567: ifnull +8 -> 575
// 565: invokevirtual 195 java/net/HttpURLConnection:disconnect ()V
// 570: aload 12
// 568: iload_2
// 572: invokevirtual 191 java/net/HttpURLConnection:disconnect ()V
// 569: istore 7
// 575: aload_3
// 571: aload 10
// 576: athrow
// 573: astore 6
// 577: lload_0
// 575: iload 4
// 578: iload 7
// 577: istore 8
// 580: aload 6
// 579: goto -189 -> 390
// 582: aconst_null
// 582: astore_3
// 583: iconst_0
// 583: aload 12
// 584: iconst_0
// 585: ifnull +8 -> 593
// 585: invokestatic 201 com/nianticlabs/nia/network/NiaNet:nativeCallback (JILjava/lang/String;Ljava/nio/ByteBuffer;II)V
// 588: aload 12
// 588: return
// 590: invokevirtual 195 java/net/HttpURLConnection:disconnect ()V
// 589: iconst_0
// 593: aload_3
// 590: istore 9
// 594: athrow
// 592: goto -566 -> 26
// 595: lload_0
// 596: iload 7
// 598: aload 6
// 600: aconst_null
// 601: iconst_0
// 602: iconst_0
// 603: invokestatic 205 com/nianticlabs/nia/network/NiaNet:nativeCallback (JILjava/lang/String;Ljava/nio/ByteBuffer;II)V
// 606: return
// 607: iconst_0
// 608: istore 9
// 610: goto -584 -> 26
// Local variable table:
// Local variable table:
// start length slot name signature
// start length slot name signature
// 0 595 0 paramLong long
// 0 613 0 paramLong long
// 0 595 2 paramInt1 int
// 0 613 2 paramInt1 int
// 0 595 3 paramString1 String
// 0 613 3 paramString1 String
// 0 595 4 paramInt2 int
// 0 613 4 paramInt2 int
// 0 595 5 paramString2 String
// 0 613 5 paramString2 String
// 0 595 6 paramByteBuffer ByteBuffer
// 0 613 6 paramByteBuffer ByteBuffer
// 0 595 7 paramInt3 int
// 0 613 7 paramInt3 int
// 0 595 8 paramInt4 int
// 0 613 8 paramInt4 int
// 24 567 9 i int
// 24 585 9 i int
// 3 551 10 localObject1 Object
// 3 569 10 localObject1 Object
// 55 491 11 str String
// 55 509 11 str String
// 52 519 12 localObject2 Object
// 52 537 12 localObject2 Object
// 63 418 13 localObject3 Object
// 63 436 13 localObject3 Object
// Exception table:
// Exception table:
// from to target type
// from to target type
// 8 23 398 finally
// 8 23 416 finally
// 31 34 398 finally
// 31 34 416 finally
// 35 51 398 finally
// 35 51 416 finally
// 399 402 398 finally
// 417 420 416 finally
// 236 264 457 finally
// 254 282 475 finally
// 404 415 457 finally
// 422 433 475 finally
// 415 454 457 finally
// 433 472 475 finally
// 72 90 493 java/io/IOException
// 72 90 511 java/io/IOException
// 103 109 493 java/io/IOException
// 103 109 511 java/io/IOException
// 122 129 493 java/io/IOException
// 122 129 511 java/io/IOException
// 142 150 493 java/io/IOException
// 142 150 511 java/io/IOException
// 163 167 493 java/io/IOException
// 163 167 511 java/io/IOException
// 180 189 493 java/io/IOException
// 180 185 511 java/io/IOException
// 212 217 493 java/io/IOException
// 198 207 511 java/io/IOException
// 230 236 493 java/io/IOException
// 230 235 511 java/io/IOException
// 277 282 493 java/io/IOException
// 248 254 511 java/io/IOException
// 295 301 493 java/io/IOException
// 295 300 511 java/io/IOException
// 314 320 493 java/io/IOException
// 313 319 511 java/io/IOException
// 333 339 493 java/io/IOException
// 332 338 511 java/io/IOException
// 472 477 493 java/io/IOException
// 351 357 511 java/io/IOException
// 490 493 493 java/io/IOException
// 490 495 511 java/io/IOException
// 72 90 564 finally
// 508 511 511 java/io/IOException
// 103 109 564 finally
// 72 90 582 finally
// 122 129 564 finally
// 103 109 582 finally
// 142 150 564 finally
// 122 129 582 finally
// 163 167 564 finally
// 142 150 582 finally
// 180 189 564 finally
// 163 167 582 finally
// 212 217 564 finally
// 180 185 582 finally
// 230 236 564 finally
// 198 207 582 finally
// 277 282 564 finally
// 230 235 582 finally
// 295 301 564 finally
// 248 254 582 finally
// 314 320 564 finally
// 295 300 582 finally
// 333 339 564 finally
// 313 319 582 finally
// 472 477 564 finally
// 332 338 582 finally
// 490 493 564 finally
// 351 357 582 finally
// 498 526 564 finally
// 490 495 582 finally
// 508 511 582 finally
// 516 544 582 finally
}
}
private static String getMethodString(int paramInt)
private static String getMethodString(int paramInt)
{
{
switch (paramInt)
switch (paramInt)
{
{
default:
default:
Log.e("NiaNet", "Unsupported HTTP method " + paramInt + ", using GET.");
Log.e("NiaNet", "Unsupported HTTP method " + paramInt + ", using GET.");
return "GET";
return "GET";
case 0:
case 0:
return "GET";
return "GET";
case 1:
case 1:
return "HEAD";
return "HEAD";
case 2:
case 2:
return "POST";
return "POST";
case 3:
case 3:
return "PUT";
return "PUT";
}
}
return "DELETE";
return "DELETE";
}
}
private static String joinHeaders(HttpURLConnection paramHttpURLConnection)
private static String joinHeaders(HttpURLConnection paramHttpURLConnection)
{
{
StringBuilder localStringBuilder = new StringBuilder();
StringBuilder localStringBuilder = new StringBuilder();
int i = 0;
int i = 0;
for (;;)
for (;;)
{
{
String str1 = paramHttpURLConnection.getHeaderFieldKey(i);
String str1 = paramHttpURLConnection.getHeaderFieldKey(i);
if (str1 == null) {
if (str1 == null) {
break;
break;
}
}
String str2 = paramHttpURLConnection.getHeaderField(i);
String str2 = paramHttpURLConnection.getHeaderField(i);
if (str2 == null) {
if (str2 == null) {
break;
break;
}
}
localStringBuilder.append(str1);
localStringBuilder.append(str1);
localStringBuilder.append(": ");
localStringBuilder.append(": ");
localStringBuilder.append(str2);
localStringBuilder.append(str2);
localStringBuilder.append("\n");
localStringBuilder.append("\n");
i += 1;
i += 1;
}
}
if (localStringBuilder.length() == 0) {
if (localStringBuilder.length() == 0) {
return null;
return null;
}
}
return localStringBuilder.toString();
return localStringBuilder.toString();
}
}
private static native void nativeCallback(long paramLong, int paramInt1, String paramString, ByteBuffer paramByteBuffer, int paramInt2, int paramInt3);
private static native void nativeCallback(long paramLong, int paramInt1, String paramString, ByteBuffer paramByteBuffer, int paramInt2, int paramInt3);
private static native void nativeSetupConnection(long paramLong, HttpURLConnection paramHttpURLConnection);
private static long parseHttpDateTime(String paramString)
private static long parseHttpDateTime(String paramString)
throws ParseException
throws ParseException
{
{
return new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz").parse(paramString).getTime();
return new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz").parse(paramString).getTime();
}
}
/* Error */
/* Error */
private static int readDataSteam(HttpURLConnection paramHttpURLConnection)
private static int readDataSteam(HttpURLConnection paramHttpURLConnection)
throws java.io.IOException
throws java.io.IOException
{
{
// Byte code:
// Byte code:
// 0: aload_0
// 0: aload_0
// 1: invokevirtual 180 java/net/HttpURLConnection:getResponseCode ()I
// 1: invokevirtual 184 java/net/HttpURLConnection:getResponseCode ()I
// 4: sipush 200
// 4: sipush 200
// 7: if_icmpne +14 -> 21
// 7: if_icmpne +14 -> 21
// 10: aload_0
// 10: aload_0
// 11: invokevirtual 294 java/net/HttpURLConnection:getInputStream ()Ljava/io/InputStream;
// 11: invokevirtual 298 java/net/HttpURLConnection:getInputStream ()Ljava/io/InputStream;
// 14: astore_0
// 14: astore_0
// 15: aload_0
// 15: aload_0
// 16: ifnonnull +13 -> 29
// 16: ifnonnull +13 -> 29
// 19: iconst_0
// 19: iconst_0
// 20: ireturn
// 20: ireturn
// 21: aload_0
// 21: aload_0
// 22: invokevirtual 297 java/net/HttpURLConnection:getErrorStream ()Ljava/io/InputStream;
// 22: invokevirtual 301 java/net/HttpURLConnection:getErrorStream ()Ljava/io/InputStream;
// 25: astore_0
// 25: astore_0
// 26: goto -11 -> 15
// 26: goto -11 -> 15
// 29: getstatic 84 com/nianticlabs/nia/network/NiaNet:readBuffer Ljava/lang/ThreadLocal;
// 29: getstatic 84 com/nianticlabs/nia/network/NiaNet:readBuffer Ljava/lang/ThreadLocal;
// 32: invokevirtual 197 java/lang/ThreadLocal:get ()Ljava/lang/Object;
// 32: invokevirtual 201 java/lang/ThreadLocal:get ()Ljava/lang/Object;
// 35: checkcast 156 java/nio/ByteBuffer
// 35: checkcast 160 java/nio/ByteBuffer
// 38: astore 8
// 38: astore 8
// 40: aload 8
// 40: aload 8
// 42: invokevirtual 164 java/nio/ByteBuffer:array ()[B
// 42: invokevirtual 168 java/nio/ByteBuffer:array ()[B
// 45: astore 7
// 45: astore 7
// 47: aload 8
// 47: aload 8
// 49: invokevirtual 168 java/nio/ByteBuffer:arrayOffset ()I
// 49: invokevirtual 172 java/nio/ByteBuffer:arrayOffset ()I
// 52: istore 5
// 52: istore 5
// 54: iload 5
// 54: iload 5
// 56: istore_1
// 56: istore_1
// 57: iconst_1
// 57: iconst_1
// 58: istore_3
// 58: istore_3
// 59: aload_0
// 59: aload_0
// 60: invokevirtual 302 java/io/InputStream:available ()I
// 60: invokevirtual 306 java/io/InputStream:available ()I
// 63: istore 6
// 63: istore 6
// 65: iload 5
// 65: iload 5
// 67: istore 4
// 67: istore 4
// 69: aload 7
// 69: aload 7
// 71: astore 8
// 71: astore 8
// 73: iload_1
// 73: iload_1
// 74: istore_2
// 74: istore_2
// 75: aload 7
// 75: aload 7
// 77: arraylength
// 77: arraylength
// 78: iload 6
// 78: iload 6
// 80: iload_1
// 80: iload_1
// 81: iadd
// 81: iadd
// 82: if_icmpgt +68 -> 150
// 82: if_icmpgt +68 -> 150
// 85: iload 6
// 85: iload 6
// 87: iload_1
// 87: iload_1
// 88: iadd
// 88: iadd
// 89: iload 5
// 89: iload 5
// 91: isub
// 91: isub
// 92: iconst_2
// 92: iconst_2
// 93: imul
// 93: imul
// 94: invokestatic 306 java/nio/ByteBuffer:allocateDirect (I)Ljava/nio/ByteBuffer;
// 94: invokestatic 310 java/nio/ByteBuffer:allocateDirect (I)Ljava/nio/ByteBuffer;
// 97: astore 9
// 97: astore 9
// 99: iload_1
// 99: iload_1
// 100: iload 5
// 100: iload 5
// 102: isub
// 102: isub
// 103: istore_2
// 103: istore_2
// 104: aload 9
// 104: aload 9
// 106: invokevirtual 168 java/nio/ByteBuffer:arrayOffset ()I
// 106: invokevirtual 172 java/nio/ByteBuffer:arrayOffset ()I
// 109: istore_1
// 109: istore_1
// 110: iload_2
// 110: iload_2
// 111: ifle +17 -> 128
// 111: ifle +17 -> 128
// 114: aload 7
// 114: aload 7
// 116: iload 5
// 116: iload 5
// 118: aload 9
// 118: aload 9
// 120: invokevirtual 164 java/nio/ByteBuffer:array ()[B
// 120: invokevirtual 168 java/nio/ByteBuffer:array ()[B
// 123: iload_1
// 123: iload_1
// 124: iload_2
// 124: iload_2
// 125: invokestatic 312 java/lang/System:arraycopy (Ljava/lang/Object;ILjava/lang/Object;II)V
// 125: invokestatic 316 java/lang/System:arraycopy (Ljava/lang/Object;ILjava/lang/Object;II)V
// 128: iload_1
// 128: iload_1
// 129: istore 4
// 129: istore 4
// 131: iload_2
// 131: iload_2
// 132: iload_1
// 132: iload_1
// 133: iadd
// 133: iadd
// 134: istore_2
// 134: istore_2
// 135: aload 9
// 135: aload 9
// 137: invokevirtual 164 java/nio/ByteBuffer:array ()[B
// 137: invokevirtual 168 java/nio/ByteBuffer:array ()[B
// 140: astore 8
// 140: astore 8
// 142: getstatic 84 com/nianticlabs/nia/network/NiaNet:readBuffer Ljava/lang/ThreadLocal;
// 142: getstatic 84 com/nianticlabs/nia/network/NiaNet:readBuffer Ljava/lang/ThreadLocal;
// 145: aload 9
// 145: aload 9
// 147: invokevirtual 316 java/lang/ThreadLocal:set (Ljava/lang/Object;)V
// 147: invokevirtual 320 java/lang/ThreadLocal:set (Ljava/lang/Object;)V
// 150: aload_0
// 150: aload_0
// 151: aload 8
// 151: aload 8
// 153: iload_2
// 153: iload_2
// 154: aload 8
// 154: aload 8
// 156: arraylength
// 156: arraylength
// 157: iload_2
// 157: iload_2
// 158: isub
// 158: isub
// 159: invokevirtual 320 java/io/InputStream:read ([BII)I
// 159: invokevirtual 324 java/io/InputStream:read ([BII)I
// 162: istore_1
// 162: istore_1
// 163: iload_1
// 163: iload_1
// 164: iflt +37 -> 201
// 164: iflt +37 -> 201
// 167: iload_2
// 167: iload_2
// 168: iload_1
// 168: iload_1
// 169: iadd
// 169: iadd
// 170: istore_2
// 170: istore_2
// 171: iload_3
// 171: iload_3
// 172: istore 6
// 172: istore 6
// 174: iload 4
// 174: iload 4
// 176: istore 5
// 176: istore 5
// 178: aload 8
// 178: aload 8
// 180: astore 7
// 180: astore 7
// 182: iload 6
// 182: iload 6
// 184: istore_3
// 184: istore_3
// 185: iload_2
// 185: iload_2
// 186: istore_1
// 186: istore_1
// 187: iload 6
// 187: iload 6
// 189: ifne -130 -> 59
// 189: ifne -130 -> 59
// 192: aload_0
// 192: aload_0
// 193: invokevirtual 321 java/io/InputStream:close ()V
// 193: invokevirtual 325 java/io/InputStream:close ()V
// 196: iload_2
// 196: iload_2
// 197: iload 4
// 197: iload 4
// 199: isub
// 199: isub
// 200: ireturn
// 200: ireturn
// 201: iconst_0
// 201: iconst_0
// 202: istore 6
// 202: istore 6
// 204: goto -30 -> 174
// 204: goto -30 -> 174
// 207: astore 7
// 207: astore 7
// 209: aload_0
// 209: aload_0
// 210: invokevirtual 321 java/io/InputStream:close ()V
// 210: invokevirtual 325 java/io/InputStream:close ()V
// 213: aload 7
// 213: aload 7
// 215: athrow
// 215: athrow
// Local variable table:
// Local variable table:
// start length slot name signature
// start length slot name signature
// 0 216 0 paramHttpURLConnection HttpURLConnection
// 0 216 0 paramHttpURLConnection HttpURLConnection
// 56 131 1 i int
// 56 131 1 i int
// 74 126 2 j int
// 74 126 2 j int
// 58 127 3 k int
// 58 127 3 k int
// 67 133 4 m int
// 67 133 4 m int
// 52 125 5 n int
// 52 125 5 n int
// 63 140 6 i1 int
// 63 140 6 i1 int
// 45 136 7 localObject1 Object
// 45 136 7 localObject1 Object
// 207 7 7 localObject2 Object
// 207 7 7 localObject2 Object
// 38 141 8 localObject3 Object
// 38 141 8 localObject3 Object
// 97 49 9 localByteBuffer ByteBuffer
// 97 49 9 localByteBuffer ByteBuffer
// Exception table:
// Exception table:
// from to target type
// from to target type
// 40 54 207 finally
// 40 54 207 finally
// 59 65 207 finally
// 59 65 207 finally
// 75 99 207 finally
// 75 99 207 finally
// 104 110 207 finally
// 104 110 207 finally
// 114 128 207 finally
// 114 128 207 finally
// 135 150 207 finally
// 135 150 207 finally
// 150 163 207 finally
// 150 163 207 finally
}
}
public static void request(long paramLong, int paramInt1, final String paramString1, final int paramInt2, final String paramString2, final ByteBuffer paramByteBuffer, final int paramInt3, final int paramInt4)
public static void request(long paramLong, int paramInt1, final String paramString1, final int paramInt2, final String paramString2, final ByteBuffer paramByteBuffer, final int paramInt3, final int paramInt4)
{
{
synchronized (pendingRequestIds)
synchronized (pendingRequestIds)
{
{
pendingRequestIds.add(Integer.valueOf(paramInt1));
pendingRequestIds.add(Integer.valueOf(paramInt1));
executor.execute(new Runnable()
executor.execute(new Runnable()
{
{
public void run()
public void run()
{
{
NiaNet.doSyncRequest(this.val$object, paramString1, paramInt2, paramString2, paramByteBuffer, paramInt3, paramInt4, this.val$bodySize);
NiaNet.doSyncRequest(this.val$object, paramString1, paramInt2, paramString2, paramByteBuffer, paramInt3, paramInt4, this.val$bodySize);
}
}
});
});
return;
return;
}
}
}
}
private static void setHeaders(HttpURLConnection paramHttpURLConnection, String paramString)
private static void setHeaders(HttpURLConnection paramHttpURLConnection, String paramString)
{
{
if ((paramString == null) || (paramString.isEmpty())) {
if ((paramString == null) || (paramString.isEmpty())) {
return;
return;
}
}
int i = 0;
int i = 0;
int k = paramString.indexOf('\n', i);
int k = paramString.indexOf('\n', i);
int j = k;
int j = k;
if (k < 0) {
if (k < 0) {
j = paramString.length();
j = paramString.length();
}
}
int m = paramString.indexOf(':', i);
int m = paramString.indexOf(':', i);
k = m;
k = m;
if (m < 0) {
if (m < 0) {
k = paramString.length();
k = paramString.length();
}
}
String str1 = paramString.substring(i, k);
String str1 = paramString.substring(i, k);
String str2 = paramString.substring(k + 1, j);
String str2 = paramString.substring(k + 1, j);
if ("If-Modified-Since".equals(str1)) {}
if ("If-Modified-Since".equals(str1)) {}
for (;;)
for (;;)
{
{
try
try
{
{
paramHttpURLConnection.setIfModifiedSince(parseHttpDateTime(str2));
paramHttpURLConnection.setIfModifiedSince(parseHttpDateTime(str2));
j += 1;
j += 1;
i = j;
i = j;
if (j < paramString.length()) {
if (j < paramString.length()) {
break;
break;
}
}
return;
return;
}
}
catch (ParseException localParseException)
catch (ParseException localParseException)
{
{
Log.e("NiaNet", "If-Modified-Since Date/Time parse failed. " + localParseException.getMessage());
Log.e("NiaNet", "If-Modified-Since Date/Time parse failed. " + localParseException.getMessage());
continue;
continue;
}
}
paramHttpURLConnection.setRequestProperty(localParseException, str2);
paramHttpURLConnection.setRequestProperty(localParseException, str2);
}
}
}
}
}
}



/* Location: C:\Users\gateway\Downloads\dex2jar-2.0\dex2jar-2.0\classes-dex2jar.jar!\com\nianticlabs\nia\network\NiaNet.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/