humble-video-noarch/src/main/java/io/humble/video/Configuration.java
@SuppressWarnings("unchecked")
  public static void configure(final Properties properties, final Configurable config)
  {
    for (
        final Enumeration<String> names = (Enumeration<String>) properties.propertyNames();
        names.hasMoreElements();
    )
    {
      final String name = names.nextElement();
      final String value = properties.getProperty(name);
      if (value != null) {
        try {
          config.setProperty(name, value);
        } catch (PropertyNotFoundException e) { 
          log.warn("Could not find property on object {}; name=\"{}\"; value=\"{}\"",
              new Object[]{
              config,
              name,
              value
          });
        }
      }
    }
  }
@SuppressWarnings("unchecked")
  public static void configure(final Properties properties, final Configurable config)
  {
    for (
        final Enumeration<String> names = (Enumeration<String>) properties.propertyNames();
        names.hasMoreElements();
    )
    {
      final String name = names.nextElement();
      final String value = properties.getProperty(name);
      if (value != null) {
        try {
          config.setProperty(name, value);
        } catch (PropertyNotFoundException e) { 
          log.warn("Could not find property on object {}; name=\"{}\"; value=\"{}\"",
              new Object[]{
              config,
              name,
              value
          });
        }
      }
    }
  }
@ SuppressWarnings ( "unchecked" ) public static void configure ( final Properties properties , final Configurable config ) { for ( final Enumeration < String > names = ( Enumeration < String > ) properties . propertyNames ( ) ; names . hasMoreElements ( ) ; ) { final String name = names . nextElement ( ) ; final String value = properties . getProperty ( name ) ; if ( value != null ) { try { config . setProperty ( name , value ) ; } catch ( PropertyNotFoundException e ) { log . warn ( "Could not find property on object {}; name=\"{}\"; value=\"{}\"" , new Object [ ] { config , name , value } ) ; } } } }
Configures an {@link Configurable} from a set of Java {@link Properties}.
<p>
Here's some sample code that shows configuring a IStreamCoder
from a FFmpeg preset file:
</p>
<pre>
Properties props = new Properties();
props.load(new FileInputStream(file));
IStreamCoder coder = IStreamCoder.make(Direction.ENCODING);
int retval = Configuration.configure(props, coder);
if (retval < 0)
throw new RuntimeException("Could not configure object");
</pre>
@param properties The properties to use.
@param config The item to configure.
Configures an {