Skip to content
Java binding for reading compiled odict files ☕️
Java Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main/java
.gitignore
BUILD
README.md
WORKSPACE

README.md

ODict Java API

Hi there! This library provides a native Java implementation of an ODict reader, capable of reading files produced by the Open Dictionary Project compiler.

Using the API

The API is fairly straightforward, though may change significantly in the future. Basically, there's only one command you really gotta worry about:

import org.odict.java.ODReader;

ODictionary dict = ODReader.read("path/to/odict/file");

Just pass in the compiled .odict file location as a parameter and BAM! You get back an ODictionary object, with which you can do nifty stuff like this:

// Look up an entry in the dictionary and return it as JSON
String entry = dict.getEntryAsJSON("some entry");

// Check if the dictionary contains an entry
boolean hasEntry = dict.hasEntry("some entry");

// Check the ODict version that produced the file
short version = dict.getVersion();

Building

To build the ODict Java library, you'll need a copy of flatc installed and Facebook's buck build tool. Then just run:

$ bazel build it

Also make sure you have a recent version of Java (8+ preferably). Everything else should run just peachy. It helps if you're on a UNIX system, though. To export the library to a file, build the JAR:

$ bazel build jar

This will create a fat JAR file at bazel-bin/src/main/java/libodict.jar.

You can’t perform that action at this time.