code: public static Persistable persistable(final ByteBuffer buffer) {
          return new Persistable() {
  
              @Override
              public int size() {
                  return buffer.limit();
              }
  
              @Override
              public void write(ByteBuffer buffer1) {
                  buffer1.put(buffer);
                  buffer1.flip();
              }
  
              @Override
              public void read(ByteBuffer buffer1) {
                  buffer.rewind();
                  buffer.put(buffer1);
                  buffer.rewind();
              }
  
          };
      }
docs: Converts a {@link ByteBuffer} into a {@link Persistable}.
  
  @param buffer The buffer
  @return A Persistable wrapper for the buffer.