/** * Resolve the supplied URL to a JSON document, read the contents, and parse into a {@link RepositoryConfiguration}. * * @param url the URL; may not be null * @return the parsed repository configuration; never null * @throws ParsingException if the content could not be parsed as a valid JSON document */ public static RepositoryConfiguration read( URL url ) throws ParsingException { CheckArg.isNotNull(url, "url"); Document doc = Json.read(url); return new RepositoryConfiguration(doc, withoutExtension(url.getFile())); }
/** * Read the supplied JSON file and parse into a {@link RepositoryConfiguration}. * * @param file the file; may not be null * @return the parsed repository configuration; never null * @throws ParsingException if the content could not be parsed as a valid JSON document * @throws FileNotFoundException if the file could not be found */ public static RepositoryConfiguration read( File file ) throws ParsingException, FileNotFoundException { CheckArg.isNotNull(file, "file"); Document doc = Json.read(new FileInputStream(file)); return new RepositoryConfiguration(doc, withoutExtension(file.getName())); }
/** * Read the supplied JSON file and parse into a {@link RepositoryConfiguration}. * * @param file the file; may not be null * @return the parsed repository configuration; never null * @throws ParsingException if the content could not be parsed as a valid JSON document * @throws FileNotFoundException if the file could not be found */ public static RepositoryConfiguration read( File file ) throws ParsingException, FileNotFoundException { CheckArg.isNotNull(file, "file"); Document doc = Json.read(new FileInputStream(file)); return new RepositoryConfiguration(doc, withoutExtension(file.getName())); }
/** * Resolve the supplied URL to a JSON document, read the contents, and parse into a {@link RepositoryConfiguration}. * * @param url the URL; may not be null * @return the parsed repository configuration; never null * @throws ParsingException if the content could not be parsed as a valid JSON document */ public static RepositoryConfiguration read( URL url ) throws ParsingException { CheckArg.isNotNull(url, "url"); Document doc = Json.read(url); return new RepositoryConfiguration(doc, withoutExtension(url.getFile())); }
return new RepositoryConfiguration(doc, withoutExtension(resourcePathOrJsonContentString));
return new RepositoryConfiguration(doc, withoutExtension(resourcePathOrJsonContentString));
/** * Read the supplied stream containing a JSON file, and parse into a {@link RepositoryConfiguration}. * * @param stream the file; may not be null * @param name the name of the resource; may not be null * @return the parsed repository configuration; never null * @throws ParsingException if the content could not be parsed as a valid JSON document * @throws FileNotFoundException if the file could not be found */ public static RepositoryConfiguration read( InputStream stream, String name ) throws ParsingException, FileNotFoundException { CheckArg.isNotNull(stream, "stream"); CheckArg.isNotNull(name, "name"); Document doc = Json.read(stream); return new RepositoryConfiguration(doc, withoutExtension(name)); }
/** * Read the supplied stream containing a JSON file, and parse into a {@link RepositoryConfiguration}. * * @param stream the file; may not be null * @param name the name of the resource; may not be null * @return the parsed repository configuration; never null * @throws ParsingException if the content could not be parsed as a valid JSON document * @throws FileNotFoundException if the file could not be found */ public static RepositoryConfiguration read( InputStream stream, String name ) throws ParsingException, FileNotFoundException { CheckArg.isNotNull(stream, "stream"); CheckArg.isNotNull(name, "name"); Document doc = Json.read(stream); return new RepositoryConfiguration(doc, withoutExtension(name)); }