Exemplo n.º 1
0
 public static Settings readSettingsFromStream(StreamInput in) throws IOException {
   Builder builder = new Builder();
   int numberOfSettings = in.readVInt();
   for (int i = 0; i < numberOfSettings; i++) {
     builder.put(in.readString(), in.readString());
   }
   return builder.build();
 }
Exemplo n.º 2
0
 @Override
 public Settings getByPrefix(String prefix) {
   Builder builder = new Builder();
   for (Map.Entry<String, String> entry : getAsMap().entrySet()) {
     if (entry.getKey().startsWith(prefix)) {
       if (entry.getKey().length() < prefix.length()) {
         // ignore this one
         continue;
       }
       builder.put(entry.getKey().substring(prefix.length()), entry.getValue());
     }
   }
   builder.classLoader(classLoader);
   return builder.build();
 }