public static ByteBuffer encode(String string) throws CharacterCodingException {
  return encode(string,true);
}

public static ByteBuffer encode ( String string ) throws CharacterCodingException { return encode ( string , true ) ; }
converts the provided string to bytes using the utf - 8 encoding . if the input is malformed , invalid chars are replaced by a default value .
