package com.google.android.m4b.maps.ad;

import java.io.DataInput;
import java.io.EOFException;
import java.io.UTFDataFormatException;

public final class a
  implements DataInput
{
  private byte[] a;
  private int b;
  private int c;
  private char[] d;

  public a(byte[] paramArrayOfByte)
  {
    this.a = paramArrayOfByte;
    this.b = this.a.length;
    this.c = 0;
    this.d = new char[''];
  }

  private static String a(byte[] paramArrayOfByte, char[] paramArrayOfChar, int paramInt1, int paramInt2)
  {
    int i = 0;
    int j = 0;
    while (j < paramInt2)
    {
      int k = j + 1;
      int m = (char)paramArrayOfByte[(j + paramInt1)];
      paramArrayOfChar[i] = m;
      if (m < 128)
      {
        i++;
        j = k;
      }
      else
      {
        int n = paramArrayOfChar[i];
        if ((n & 0xE0) == 192)
        {
          if (k >= paramInt2)
            throw new UTFDataFormatException("Second byte at " + k + " does not match UTF8 Specification");
          int i6 = k + 1;
          int i7 = paramArrayOfByte[(paramInt1 + k)];
          if ((i7 & 0xC0) != 128)
            throw new UTFDataFormatException("Second byte at " + (i6 - 1) + " does not match UTF8 Specification");
          int i8 = i + 1;
          paramArrayOfChar[i] = ((char)((n & 0x1F) << 6 | i7 & 0x3F));
          i = i8;
          j = i6;
        }
        else if ((n & 0xF0) == 224)
        {
          if (k + 1 >= paramInt2)
            throw new UTFDataFormatException("Third byte at " + (k + 1) + " does not match UTF8 Specification");
          int i1 = k + 1;
          int i2 = paramArrayOfByte[(k + paramInt1)];
          int i3 = i1 + 1;
          int i4 = paramArrayOfByte[(i1 + paramInt1)];
          if (((i2 & 0xC0) != 128) || ((i4 & 0xC0) != 128))
            throw new UTFDataFormatException("Second or third byte at " + (i3 - 2) + " does not match UTF8 Specification");
          int i5 = i + 1;
          paramArrayOfChar[i] = ((char)((n & 0xF) << 12 | (i2 & 0x3F) << 6 | i4 & 0x3F));
          i = i5;
          j = i3;
        }
        else
        {
          throw new UTFDataFormatException("Input at " + (k - 1) + " does not match UTF8 Specification");
        }
      }
    }
    return new String(paramArrayOfChar, 0, i);
  }

  public final int a()
  {
    return this.c;
  }

  public final boolean readBoolean()
  {
    try
    {
      byte[] arrayOfByte = this.a;
      int i = this.c;
      this.c = (i + 1);
      int j = arrayOfByte[i];
      return j != 0;
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final byte readByte()
  {
    try
    {
      byte[] arrayOfByte = this.a;
      int i = this.c;
      this.c = (i + 1);
      byte b1 = arrayOfByte[i];
      return b1;
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final char readChar()
  {
    try
    {
      byte[] arrayOfByte1 = this.a;
      int i = this.c;
      this.c = (i + 1);
      int j = arrayOfByte1[i];
      byte[] arrayOfByte2 = this.a;
      int k = this.c;
      this.c = (k + 1);
      int m = arrayOfByte2[k];
      return (char)(m & 0xFF | j << 8);
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final double readDouble()
  {
    return Double.longBitsToDouble(readLong());
  }

  public final float readFloat()
  {
    return Float.intBitsToFloat(readInt());
  }

  public final void readFully(byte[] paramArrayOfByte)
  {
    readFully(paramArrayOfByte, 0, paramArrayOfByte.length);
  }

  public final void readFully(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
  {
    if (paramInt2 == 0)
      return;
    if (paramInt1 + paramInt2 > paramArrayOfByte.length)
      throw new IndexOutOfBoundsException();
    if (paramInt2 > this.b - this.c)
    {
      this.c = this.b;
      throw new EOFException();
    }
    System.arraycopy(this.a, this.c, paramArrayOfByte, paramInt1, paramInt2);
    this.c = (paramInt2 + this.c);
  }

  public final int readInt()
  {
    try
    {
      byte[] arrayOfByte1 = this.a;
      int i = this.c;
      this.c = (i + 1);
      int j = 0xFF & arrayOfByte1[i];
      byte[] arrayOfByte2 = this.a;
      int k = this.c;
      this.c = (k + 1);
      int m = 0xFF & arrayOfByte2[k];
      byte[] arrayOfByte3 = this.a;
      int n = this.c;
      this.c = (n + 1);
      int i1 = 0xFF & arrayOfByte3[n];
      byte[] arrayOfByte4 = this.a;
      int i2 = this.c;
      this.c = (i2 + 1);
      int i3 = arrayOfByte4[i2];
      return i3 & 0xFF | (j << 24 | m << 16 | i1 << 8);
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final String readLine()
  {
    if (this.c >= this.b)
      return null;
    StringBuilder localStringBuilder = new StringBuilder();
    do
    {
      byte[] arrayOfByte = this.a;
      int i = this.c;
      this.c = (i + 1);
      char c1 = (char)arrayOfByte[i];
      if (c1 == '\n')
        return localStringBuilder.toString();
      if (c1 == '\r')
      {
        if ((this.c < this.b) && (this.a[this.c] == 10))
          this.c = (1 + this.c);
        return localStringBuilder.toString();
      }
      localStringBuilder.append(c1);
    }
    while (this.c != this.b);
    return localStringBuilder.toString();
  }

  public final long readLong()
  {
    try
    {
      byte[] arrayOfByte1 = this.a;
      int i = this.c;
      this.c = (i + 1);
      long l1 = 0xFF & arrayOfByte1[i];
      byte[] arrayOfByte2 = this.a;
      int j = this.c;
      this.c = (j + 1);
      long l2 = 0xFF & arrayOfByte2[j];
      byte[] arrayOfByte3 = this.a;
      int k = this.c;
      this.c = (k + 1);
      long l3 = 0xFF & arrayOfByte3[k];
      byte[] arrayOfByte4 = this.a;
      int m = this.c;
      this.c = (m + 1);
      long l4 = 0xFF & arrayOfByte4[m];
      byte[] arrayOfByte5 = this.a;
      int n = this.c;
      this.c = (n + 1);
      long l5 = 0xFF & arrayOfByte5[n];
      byte[] arrayOfByte6 = this.a;
      int i1 = this.c;
      this.c = (i1 + 1);
      long l6 = 0xFF & arrayOfByte6[i1];
      byte[] arrayOfByte7 = this.a;
      int i2 = this.c;
      this.c = (i2 + 1);
      long l7 = 0xFF & arrayOfByte7[i2];
      byte[] arrayOfByte8 = this.a;
      int i3 = this.c;
      this.c = (i3 + 1);
      int i4 = arrayOfByte8[i3];
      return i4 & 0xFF | (l1 << 56 | l2 << 48 | l3 << 40 | l4 << 32 | l5 << 24 | l6 << 16 | l7 << 8);
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final short readShort()
  {
    try
    {
      byte[] arrayOfByte1 = this.a;
      int i = this.c;
      this.c = (i + 1);
      int j = arrayOfByte1[i];
      byte[] arrayOfByte2 = this.a;
      int k = this.c;
      this.c = (k + 1);
      int m = arrayOfByte2[k];
      return (short)(m & 0xFF | j << 8);
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final String readUTF()
  {
    int i = readUnsignedShort();
    if (i == 0)
      return "";
    if (i > this.b - this.c)
    {
      this.c = this.b;
      throw new EOFException();
    }
    if (i > this.d.length)
      this.d = new char[i];
    String str = a(this.a, this.d, this.c, i);
    this.c = (i + this.c);
    return str;
  }

  public final int readUnsignedByte()
  {
    try
    {
      byte[] arrayOfByte = this.a;
      int i = this.c;
      this.c = (i + 1);
      int j = arrayOfByte[i];
      return j & 0xFF;
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final int readUnsignedShort()
  {
    try
    {
      byte[] arrayOfByte1 = this.a;
      int i = this.c;
      this.c = (i + 1);
      int j = 0xFF & arrayOfByte1[i];
      byte[] arrayOfByte2 = this.a;
      int k = this.c;
      this.c = (k + 1);
      int m = arrayOfByte2[k];
      return m & 0xFF | j << 8;
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException)
    {
    }
    throw new EOFException();
  }

  public final int skipBytes(int paramInt)
  {
    if (paramInt > this.b - this.c)
      paramInt = this.b - this.c;
    this.c = (paramInt + this.c);
    return paramInt;
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.ad.a
 * JD-Core Version:    0.6.2
 */