public static Properties toProperties(String propFileText) throws CharacterCodingException {
    CharsetEncoder encoder = Charset.forName("ISO-8859-1").newEncoder().onUnmappableCharacter(CodingErrorAction.REPORT);
    byte[] bytes = encoder.encode(CharBuffer.wrap(propFileText)).array();
    Properties props = new Properties();
    try {
      props.load(new ByteArrayInputStream(bytes));
    }
    catch (IOException ex) {
      throw new RuntimeException(ex); // shouldn't happen with BAIS
    }
    return props;
  }
public static Properties toProperties ( String propFileText ) throws CharacterCodingException { CharsetEncoder encoder = Charset . forName ( "ISO-8859-1" ) . newEncoder ( ) . onUnmappableCharacter ( CodingErrorAction . REPORT ) ; byte [ ] bytes = encoder . encode ( CharBuffer . wrap ( propFileText ) ) . array ( ) ; Properties props = new Properties ( ) ; try { props . load ( new ByteArrayInputStream ( bytes ) ) ; } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; } return props ; }
Converts the specified property file text to a Properties object.
@param propFileText the property file text in standard property file format
@return the resulting Properties object
@throws java.nio.charset.CharacterCodingException if invalid encoding