https://github.com/cesbit/java-qpack
Java QPack library
https://github.com/cesbit/java-qpack
Last synced: 2 months ago
JSON representation
Java QPack library
- Host: GitHub
- URL: https://github.com/cesbit/java-qpack
- Owner: cesbit
- License: mit
- Created: 2018-02-27T08:03:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-25T12:06:11.000Z (about 4 years ago)
- Last Synced: 2025-07-17T14:18:15.998Z (8 months ago)
- Language: Java
- Size: 48.8 KB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QPack Java
QPack is a fast and efficient serialization format like MessagePack. One key difference is flexible map and array support which allows to write directly to a qpack buffer without the need to know the size for the map or array beforehand.
## Installation
You can download the latest version [here](https://github.com/transceptor-technology/java-qpack/releases/latest).
But you can also clone this repository and build the project using maven (mvn >= 3.3 and java 8 are recommended):
```bash
mvn clean install -Dgpg.skip
```
After building the project, grab the `target/java-qpack-0.0-SNAPSHOT.jar` file and add it to your own project as library.
## Pack
----
Create an instance of QPack and use its pack method
```qpack.pack(Object data);```
## Unpack
When unpack is called with only the first parameter, each String will be returned as bytes.
```qpack.unpack(byte[] qp, String decoder);```
## Example
```java
package qpack-test
import java.util.Arrays;
import transceptor.technology.QPack;
public class QPackTest() {
public static void main() {
QPack qpack = new QPack();
String[] data = new String[]{"test", "qpack", "Java"};
byte[] qp = qpack.pack(data);
Object[] result = (Object[]) qpack.unpack(qp, "utf-8");
System.out.println(Arrays.toString(result));
}
}
```