Example #1
0
    /** @param pData */
    public PVRTextureHeader(final byte[] pData) {
      this.mDataByteBuffer = ByteBuffer.wrap(pData);
      this.mDataByteBuffer.rewind();
      this.mDataByteBuffer.order(ByteOrder.LITTLE_ENDIAN);

      /* Check magic bytes. */
      if (!ArrayUtils.equals(
          pData,
          11 * DataConstants.BYTES_PER_INT,
          PVRTextureHeader.MAGIC_IDENTIFIER,
          0,
          PVRTextureHeader.MAGIC_IDENTIFIER.length)) {
        throw new IllegalArgumentException("Invalid " + this.getClass().getSimpleName() + "!");
      }

      this.mPVRTextureFormat =
          PVRTextureFormat.fromID(this.getFlags() & PVRTextureHeader.FORMAT_FLAG_MASK);
    }