@Override
  public final InflaterInputStream getInputStream() throws IOException {
    final InputStream inputStream = this.onGetInputStream();

    this.mCCZHeader = new CCZHeader(StreamUtils.streamToBytes(inputStream, CCZHeader.SIZE));

    return this.mCCZHeader.getCCZCompressionFormat().wrap(inputStream);
  }
Esempio n. 2
0
  /**
   * @param pTextureManager
   * @param pPVRTextureFormat
   * @param pPVRTexturePixelBufferStrategy
   * @param pTextureOptions
   * @param pTextureStateListener
   * @throws IllegalArgumentException
   * @throws IOException
   */
  public PVRTexture(
      final TextureManager pTextureManager,
      final PVRTextureFormat pPVRTextureFormat,
      final IPVRTexturePixelBufferStrategy pPVRTexturePixelBufferStrategy,
      final TextureOptions pTextureOptions,
      final ITextureStateListener pTextureStateListener)
      throws IllegalArgumentException, IOException {
    super(
        pTextureManager,
        pPVRTextureFormat.getPixelFormat(),
        pTextureOptions,
        pTextureStateListener);
    this.mPVRTexturePixelBufferStrategy = pPVRTexturePixelBufferStrategy;

    InputStream inputStream = null;
    try {
      inputStream = this.getInputStream();
      this.mPVRTextureHeader =
          new PVRTextureHeader(StreamUtils.streamToBytes(inputStream, PVRTextureHeader.SIZE));
    } finally {
      StreamUtils.close(inputStream);
    }

    if (this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat()
        != pPVRTextureFormat.getPixelFormat()) {
      throw new IllegalArgumentException(
          "Other PVRTextureFormat: '"
              + this.mPVRTextureHeader.getPVRTextureFormat().getPixelFormat()
              + "' found than expected: '"
              + pPVRTextureFormat.getPixelFormat()
              + "'.");
    }

    if (this.mPVRTextureHeader
        .getPVRTextureFormat()
        .isCompressed()) { // TODO && ! GLHELPER_EXTENSION_PVRTC] ) {
      throw new IllegalArgumentException(
          "Invalid PVRTextureFormat: '" + this.mPVRTextureHeader.getPVRTextureFormat() + "'.");
    }

    this.mUpdateOnHardwareNeeded = true;
  }