code: public static Persistable persistable(final Streamable streamable) {
          return new Persistable() {
  
              @Override
              public int size() {
                  return streamable.size();
              }
  
              @Override
              public void write(ByteBuffer buffer) {
                  try {
                      streamable.write(new ByteBufferOutputStream(buffer));
                  } catch (IOException ex) {
                      throw new RuntimeException(ex);
                  }
              }
  
              @Override
              public void read(ByteBuffer buffer) {
                  try {
                      streamable.read(new ByteBufferInputStream(buffer));
                  } catch (IOException ex) {
                      throw new RuntimeException(ex);
                  }
              }
  
          };
      }
docs: Converts a {@link Streamable} into a {@link Persistable}.
  
  @param streamable A {@link Streamable} object.
  @return A {@link Persistable} representation of the given object.