- /**
- * Create a new YangTextSchemaSource backed by a {@link File} with {@link SourceIdentifier} derived from the file
- * name.
- *
- * @param path Backing path
- * @return A new YangTextSchemaSource
- * @throws IllegalArgumentException if the file name has invalid format or if the supplied File is not a file
- * @throws NullPointerException if file is {@code null}
- */
- public static @NonNull YangTextSource forPath(final Path path) {
- // FIXME: do not use .toFile() here
- return forPath(path, SourceIdentifier.ofYangFileName(path.toFile().getName()));
- }
-
- /**
- * Create a new YangTextSchemaSource backed by a {@link File} and specified {@link SourceIdentifier}.
- *
- * @param path Backing path
- * @param identifier source identifier
- * @return A new YangTextSchemaSource
- * @throws NullPointerException if any argument is {@code null}
- * @throws IllegalArgumentException if the supplied path is not a regular file
- */
- public static @NonNull YangTextSource forPath(final Path path, final SourceIdentifier identifier) {
- return forPath(path, identifier, StandardCharsets.UTF_8);
- }
-
- /**
- * Create a new YangTextSchemaSource backed by a {@link File} and specified {@link SourceIdentifier}.
- *
- * @param path Backing path
- * @param identifier Source identifier
- * @param charset expected stream character set
- * @return A new YangTextSchemaSource
- * @throws NullPointerException if any argument is {@code null}
- * @throws IllegalArgumentException if the supplied path is not a regular file
- */
- public static @NonNull YangTextSource forPath(final Path path, final SourceIdentifier identifier,
- final Charset charset) {
- if (Files.isRegularFile(path)) {
- return new YangTextFileSource(identifier, path, charset);
- }
- throw new IllegalArgumentException("Supplied path " + path + " is not a regular file");
- }
-