@@ -0,0 +1,1395 @@
+package com.janosgyerik.demo.objectstore;%0A%0Aimport com.example.tutorial.AddressBookProtos;%0Aimport com.janosgyerik.tools.objectstore.*;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TemporaryFolder;%0A%0Aimport java.io.IOException;%0Aimport java.util.Optional;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0A%0Apublic class ObjectStoreDemo %7B%0A    @Rule%0A    public TemporaryFolder folder = new TemporaryFolder();%0A%0A    @Test%0A    public void test_1() throws IOException %7B%0A        CountingPathGenerator pathGenerator = new CountingPathGenerator(2, 2, folder.getRoot().toPath());%0A        Reader%3CAddressBookProtos.Person%3E reader = AddressBookProtos.Person::parseFrom;%0A        Writer%3CAddressBookProtos.Person%3E writer = (out, value) -%3E value.writeTo(out);%0A        ObjectStore%3CString, AddressBookProtos.Person%3E store = new SimpleObjectStore%3C%3E(pathGenerator, reader, writer);%0A%0A        AddressBookProtos.Person.Builder builder = AddressBookProtos.Person.newBuilder();%0A        AddressBookProtos.Person jack = builder.setName(%22Jack%22).setId(1).build();%0A        AddressBookProtos.Person mike = builder.setName(%22Mike%22).setId(2).build();%0A%0A        store.write(jack.getName(), jack);%0A        store.write(mike.getName(), mike);%0A%0A        assertThat(store.read(jack.getName())).isEqualTo(Optional.of(jack));%0A        assertThat(store.read(mike.getName())).isEqualTo(Optional.of(mike));%0A    %7D%0A%7D%0A

Add object store demo