code: public static ByteBuffer toByteBuffer(String text) {
          notNull("text", text);
          if (text.isEmpty()) {
              return ByteBuffer.allocate(0);
          }
          return ByteBuffer.wrap(text.getBytes(UTF_8));
      }
docs: Converts a string to a ByteBuffer with UTF-8 encoding.
  @param text Some text to convert
  @return A ByteBuffer containing the text as UTF-8 encoded bytes
  @throws IllegalArgumentException if text is null