|
| 1 | +## JavaFastPFOR demo |
| 2 | + |
| 3 | +This small Maven project shows how to use JavaFastPFOR (from the fast-pack/JavaFastPFOR repository) to compress and uncompress an int[] using `FastPFOR128`. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- JDK 21 installed and available on your PATH |
| 8 | +- Maven 3.6+ (tested with Maven 3.9) |
| 9 | + |
| 10 | +Verify with: |
| 11 | + |
| 12 | +```bash |
| 13 | +mvn -v |
| 14 | +java -version |
| 15 | +``` |
| 16 | + |
| 17 | +## Maven dependency (JitPack) |
| 18 | + |
| 19 | +Add the JitPack repository to your `pom.xml` and use the exact coordinates published for this project. The project exposes the artifact as `JavaFastPFOR` with a tag-style version. For example: |
| 20 | + |
| 21 | +```xml |
| 22 | +<repositories> |
| 23 | + <repository> |
| 24 | + <id>jitpack.io</id> |
| 25 | + <url>https://jitpack.io</url> |
| 26 | + </repository> |
| 27 | +</repositories> |
| 28 | + |
| 29 | +<dependency> |
| 30 | + <groupId>com.github.fast-pack</groupId> |
| 31 | + <artifactId>JavaFastPFOR</artifactId> |
| 32 | + <version>JavaFastPFOR-0.3.0</version> |
| 33 | +</dependency> |
| 34 | +``` |
| 35 | + |
| 36 | +Note: coordinates are case-sensitive. Using `JavaFastPFor` (different case) or a short `0.3.0` version may fail if that exact artifact/version was not published. |
| 37 | + |
| 38 | +## Build |
| 39 | + |
| 40 | +Download dependencies and compile: |
| 41 | + |
| 42 | +```bash |
| 43 | +mvn -U package |
| 44 | +``` |
| 45 | + |
| 46 | +If Maven cached a failed resolution you can clear the specific cached artifact and retry: |
| 47 | + |
| 48 | +```bash |
| 49 | +rm -rf ~/.m2/repository/com/github/fast-pack/JavaFastPFOR |
| 50 | +mvn -U package |
| 51 | +``` |
| 52 | + |
| 53 | +## Run the demo |
| 54 | + |
| 55 | +Run the `Main` class included in this project: |
| 56 | + |
| 57 | +```bash |
| 58 | +mvn exec:java -Dexec.mainClass=org.example.Main |
| 59 | +``` |
| 60 | + |
| 61 | +The demo compresses an array of length 9984, then uncompresses it and prints a small verification summary. Example output: |
| 62 | + |
| 63 | +``` |
| 64 | +N=9984 compressedSizeWords=XXX mismatches=0 |
| 65 | +first 20 original: [0, 0, 0, ...] |
| 66 | +first 20 recovered: [0, 0, 0, ...] |
| 67 | +``` |
| 68 | + |
| 69 | +## Troubleshooting |
| 70 | + |
| 71 | +- "Could not find artifact ..." when building: check that the `artifactId` and `version` in your `pom.xml` exactly match what JitPack exposes (case-sensitive). Use the repository page `https://jitpack.io/#fast-pack/JavaFastPFOR` to inspect available versions/tags. |
| 72 | +- If JitPack builds are failing for a tag, try using the exact commit hash or `master-SNAPSHOT` while debugging. |
0 commit comments