code: public static DictionaryMetadata read(InputStream metadataStream) throws IOException {
      Map<DictionaryAttribute, String> map = new HashMap<DictionaryAttribute, String>();
      final Properties properties = new Properties();
      properties.load(new InputStreamReader(metadataStream, "UTF-8"));
  
      // Handle back-compatibility for encoder specification.
      if (!properties.containsKey(DictionaryAttribute.ENCODER.propertyName)) {
        boolean hasDeprecated = properties.containsKey("fsa.dict.uses-suffixes") ||
                                properties.containsKey("fsa.dict.uses-infixes") ||
                                properties.containsKey("fsa.dict.uses-prefixes");
  
        boolean usesSuffixes = Boolean.valueOf(properties.getProperty("fsa.dict.uses-suffixes", "true"));
        boolean usesPrefixes = Boolean.valueOf(properties.getProperty("fsa.dict.uses-prefixes", "false"));
        boolean usesInfixes  = Boolean.valueOf(properties.getProperty("fsa.dict.uses-infixes",  "false"));
  
        final EncoderType encoder;
        if (usesInfixes) {
          encoder = EncoderType.INFIX;
        } else if (usesPrefixes) {
          encoder = EncoderType.PREFIX;
        } else if (usesSuffixes) {
          encoder = EncoderType.SUFFIX;
        } else {
          encoder = EncoderType.NONE;
        }
  
        if (!hasDeprecated) {
          throw new IOException("Use an explicit " +
              DictionaryAttribute.ENCODER.propertyName + "=" + encoder.name() +
              " metadata key: ");
        }
  
        throw new IOException("Deprecated encoder keys in metadata. Use " +
            DictionaryAttribute.ENCODER.propertyName + "=" + encoder.name());
      }
  
      for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
        String key = (String) e.nextElement();
        map.put(DictionaryAttribute.fromPropertyName(key), properties.getProperty(key));
      }
  
      return new DictionaryMetadata(map);
    }
docs: Read dictionary metadata from a property file (stream).
  
  @param metadataStream The stream with metadata.
  @return Returns {@link DictionaryMetadata} read from a the stream (property file).
  @throws IOException Thrown if an I/O exception occurs.