Hpack
Header Compression for HTTP/2
Install / Use
/learn @twitter/HpackREADME
HPACK

Download
HPACK can be downloaded from the Maven central repository. Add the following dependency section to your pom.xml file:
<dependency>
<groupId>com.twitter</groupId>
<artifactId>hpack</artifactId>
<version>1.0.1</version>
</dependency>
Getting Started
This library provides support for compression of header lists into header blocks. The following code fragment demonstrates the use of Encoder and Decoder:
try {
int maxHeaderSize = 4096;
int maxHeaderTableSize = 4096;
byte[] name = "name".getBytes();
byte[] value = "value".getBytes();
boolean sensitive = false;
ByteArrayOutputStream out = new ByteArrayOutputStream();
// encode header list into header block
Encoder encoder = new Encoder(maxHeaderTableSize);
encoder.encodeHeader(out, name, value, sensitive);
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
HeaderListener listener = new HeaderListener() {
@Override
public void addHeader(byte[] name, byte[] value, boolean sensitive) {
// handle header field
}
};
// decode header list from header block
Decoder decoder = new Decoder(maxHeaderSize, maxHeaderTableSize);
decoder.decode(in, listener);
decoder.endHeaderBlock();
} catch (IOException e) {
// handle exception
}
Problems?
If you find any issues please report them or better, send a pull request.
Authors
- Jeff Pinner https://twitter.com/jpinner
- Bill Gallagher https://twitter.com/billjgallagher
License
Copyright 2013 Twitter, Inc.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
Related Skills
node-connect
340.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.1kCommit, push, and open a PR
