Java

The Java SDK talks to antd over REST by default and also exposes async and gRPC clients.

Install

dependencies {
    implementation("com.autonomi:antd-java:0.1.0")
}

Connect to the daemon

import com.autonomi.antd.AntdClient;

try (var client = new AntdClient()) {
    var health = client.health();
    System.out.println(health.network());
}

The SDK also provides AsyncAntdClient and GrpcAntdClient.

Store and retrieve data

import com.autonomi.antd.AntdClient;

public class QuickStart {
    public static void main(String[] args) throws Exception {
        try (var client = new AntdClient()) {
            var result = client.dataPutPublic("Hello, Autonomi!".getBytes());
            System.out.println(result.address());

            byte[] data = client.dataGetPublic(result.address());
            System.out.println(new String(data));
        }
    }
}

Type mappings

Autonomi type
Java type

HealthStatus

com.autonomi.antd.models.HealthStatus

PutResult

com.autonomi.antd.models.PutResult

Raw data

byte[]

Error handling

Full API reference

For all available daemon endpoints, see the REST API.

Last updated