@Override
        public void write(final Kryo kryo, final Output output, final IoY ioy) {
            final Map<String, Object> map = new HashMap<>();
            map.put("y", ioy.toString());
            try (final OutputStream stream = new ByteArrayOutputStream()) {
                final Output detachedOutput = new Output(stream);
                kryo.writeObject(detachedOutput, map);

                // have to remove the first byte because it marks a reference we don't want to have as this
                // serializer is trying to "act" like a Map
                final byte[] b = detachedOutput.toBytes();
                output.write(b, 1, b.length - 1);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
Converts an {@link IoX} to a {@link HashMap}.
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/IoYIoRegistry.java