private static ByteBuffer messageToBuffer(Streams stream, String message) throws IOException {
        String logMessage = logMessage(message);

        CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
        ByteBuffer payload = encoder.encode(CharBuffer.wrap(logMessage.toCharArray()));
        assert payload.order() == ByteOrder.BIG_ENDIAN;
        int length = payload.limit();

        ByteBuffer result = ByteBuffer.allocate(length + 8);
        result.order(ByteOrder.BIG_ENDIAN);

        result.put((byte) stream.type);
        result.position(result.position() + 3);
        result.putInt(length);
        result.put(payload);

        return result;
    }
Create a bytebuffer for a single string message. A timestamp will be added.
src/test/java/io/fabric8/maven/docker/access/log/LogRequestorTest.java