List of usage examples for javax.json Json createArrayBuilder
public static JsonArrayBuilder createArrayBuilder(Collection<?> collection)
From source file:org.hyperledger.fabric.sdk.ChaincodeCollectionConfiguration.java
/** * Creates a new ChaincodeCollectionConfiguration instance configured with details supplied in YAML format * * @param configStream A stream opened on a YAML document containing network configuration details * @return A new ChaincodeCollectionConfiguration instance * @throws InvalidArgumentException/*from www .jav a 2s . c o m*/ */ public static ChaincodeCollectionConfiguration fromYamlStream(InputStream configStream) throws InvalidArgumentException, ChaincodeCollectionConfigurationException { logger.trace("ChaincodeCollectionConfiguration.fromYamlStream..."); // Sanity check if (configStream == null) { throw new InvalidArgumentException("ConfigStream must be specified"); } Yaml yaml = new Yaml(); @SuppressWarnings("unchecked") List<Object> map = yaml.load(configStream); JsonArrayBuilder builder = Json.createArrayBuilder(map); JsonArray jsonConfig = builder.build(); return fromJsonObject(jsonConfig); }