Note: There is also an alternative implementation in TypeScript available at: https://github.com/nationalarchives/oci-tools-ts
This project is split into two parts:
-
a library (
BaseCoder.scala
) which can be used in other projects. -
a command line tool (
Main.scala
) which is useful in itself and also serves as an example of using theBaseCoder.scala
library.
Encoding to Base16 (e.g. hexadecimal):
❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 16 123456 HEX
Input: 123456
Encoded: '1E240'
Round-trip decoded: '123456'
Encoding to GCR b25 (e.g. as used by DRI for digital records):
❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 25 123456 GCRb25
Input: 123456
Encoded: 'K5RJ'
Round-trip decoded: '123456'
Encoding to OCI b25 (e.g. as used by Project Omega):
❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 25 123456 OCIb25
Input: 123456
Encoded: '8WJ7'
Round-trip decoded: '123456'
Encoding to CTD b25 (e.g. as used by Project TDR):
❯ target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar encode --round-trip 25 123456 CTDb25
Input: 123456
Encoded: '9TH8'
Round-trip decoded: '123456'
EXPERIMENTAL: There is also support for experimental URI encoding using a Base78 and Base68 alphabet, built-in as: OCIb78
and OCIb68
.
To build from source you will need the following pre-requisites:
- Git Command Line tools.
- Java 8+
- SBT (Simple Build Tool) 1.1.2+
If you wish to create a standalone application (also known as an Uber Jar, Assembly, etc.)
you can run sbt assembly
, which will generate target/scala-2.13/oci-tools-scala-assembly-0.4.0.jar
.
Given the standalone application, you can execute it by running either:
-
java -jar oci-tools-scala-assembly-0.4.0.jar
-
or, even by just executing the
oci-tools-scala-assembly-0.4.0.jar
file directly, as we compile an executable header into the Jar file. e.g. (on Linux/Mac):./oci-tools-scala-assembly-0.4.0.jar
.
- Run
sbt clean release
- Answer the questions
- Login to https://oss.sonatype.org/ then Close, and Release the Staging Repository