apache/hadoop · error · UnsupportedOperationException

byte[] arrays are not supported for DirectDecompressor

Error message

byte[] arrays are not supported for DirectDecompressor

What it means

Error "byte[] arrays are not supported for DirectDecompressor" thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibDecompressor.java:385

      super.reset();
      endOfInput = true;
    }
    
    private boolean endOfInput;

    @Override
    public void decompress(ByteBuffer src, ByteBuffer dst)
        throws IOException {
      assert dst.isDirect() : "dst.isDirect()";
      assert src.isDirect() : "src.isDirect()";
      assert dst.remaining() > 0 : "dst.remaining() > 0";      
      this.inflateDirect(src, dst);
      endOfInput = !src.hasRemaining();
    }

    @Override
    public void setDictionary(byte[] b, int off, int len) {
      throw new UnsupportedOperationException(
          "byte[] arrays are not supported for DirectDecompressor");
    }

    @Override
    public int decompress(byte[] b, int off, int len) {
      throw new UnsupportedOperationException(
          "byte[] arrays are not supported for DirectDecompressor");
    }
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Use a ZlibDecompressor constructed with a direct-Buffer-capable decompressor, or switch to the byte[]-based API.
  2. Do not pass heap byte arrays to a DirectDecompressor; use direct ByteBuffers or a non-direct decompressor instance.

When it happens

Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/ZlibDecompressor.java:385 when the library encounters an invalid state.

Common situations: Occurs when a direct (native) ZlibDecompressor is asked to decompress from a byte[] array. Use a direct ByteBuffer for direct decompressors, or use the non-direct code path for heap arrays.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/3d321071e621a57b. Report an issue: GitHub.