public CCZHeader(final byte[] pData) {
      this.mDataByteBuffer = ByteBuffer.wrap(pData);
      this.mDataByteBuffer.rewind();
      this.mDataByteBuffer.order(ByteOrder.BIG_ENDIAN);

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

      // TODO Check the version?

      this.mCCZCompressionFormat = CCZCompressionFormat.fromID(this.getCCZCompressionFormatID());
    }
Esempio n. 2
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);
    }