Eventstore.JVM client - reading stream data

Hello,

I’m learning about EventStore and have written some simple clients using the ES JVM client. I am able to append events to streams fairly successfully, but I’ve run into something I can’t quite figure out on reading data from streams.

Using the example Subscribe to All code, I’m reading events from my stream, but I don’t have a clear picture on how to functionally unpack the data coming out of it. In my onEvent method, I have an IndexedEvent. I am trying to simply print the data from the event to the console, in the same format as I inserted it into the stream.

My inserts are simple 4-byte strings (“test”) and I am trying to print using the following statement:

public void onEvent(IndexedEvent event, Closeable subscription) {

System.out.println(event.event().data().data().toString());

}

However, instead of seeing my string (“test”), I instead see this:

Content(ByteString(116, 101, 115, 116),ContentType.Binary})

Combing through the library’s source code and tests and examples, I cannot see a method by which I can convert that back into a printable, readable string.

Does anyone have any experience with this to point me in the right direction? Thanks much in advance.

http://doc.akka.io/api/akka/2.2.4/index.html#akka.util.ByteString

If not clear decodeString(charset: String): String is a good starting
point or pipe to your favorite json etc parser.

Much obliged, Greg. That got me pointed in the right direction.