Skip to content

Commit

Permalink
#191 extra ctors
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 1, 2022
1 parent eb26703 commit b29c4b2
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions src/main/java/com/jcabi/xml/XSLDocument.java
Expand Up @@ -172,7 +172,18 @@ public XSLDocument(final XML src, final String base) {
* @since 0.7.4
*/
public XSLDocument(final URL url) throws IOException {
this(new TextResource(url).toString(), url.toString());
this(url, url.toString());
}

/**
* Public ctor, from URL with alternative SystemId.
* @param url Location of document
* @param base SystemId/Base
* @throws IOException If fails to read
* @since 0.26.0
*/
public XSLDocument(final URL url, final String base) throws IOException {
this(new TextResource(url).toString(), base);
}

/**
Expand All @@ -182,7 +193,19 @@ public XSLDocument(final URL url) throws IOException {
* @since 0.21
*/
public XSLDocument(final File file) throws FileNotFoundException {
this(new TextResource(file).toString(), file.getAbsolutePath());
this(file, file.getAbsolutePath());
}

/**
* Public ctor, from file with alternative SystemId.
* @param file Location of document
* @param base SystemId/Base
* @throws FileNotFoundException If fails to read
* @since 0.26.0
*/
public XSLDocument(final File file, final String base)
throws FileNotFoundException {
this(new TextResource(file).toString(), base);
}

/**
Expand All @@ -195,14 +218,37 @@ public XSLDocument(final Path file) throws FileNotFoundException {
this(file.toFile());
}

/**
* Public ctor, from file with custom SystemId.
* @param file Location of document
* @param base SystemId/Base
* @throws FileNotFoundException If fails to read
* @since 0.26.0
*/
public XSLDocument(final Path file, final String base)
throws FileNotFoundException {
this(file.toFile(), base);
}

/**
* Public ctor, from URI.
* @param uri Location of document
* @throws IOException If fails to read
* @since 0.15
*/
public XSLDocument(final URI uri) throws IOException {
this(new TextResource(uri).toString(), uri.toString());
this(uri, uri.toString());
}

/**
* Public ctor, from URI.
* @param uri Location of document
* @param base SystemId/Base
* @throws IOException If fails to read
* @since 0.26.0
*/
public XSLDocument(final URI uri, final String base) throws IOException {
this(new TextResource(uri).toString(), base);
}

/**
Expand Down

0 comments on commit b29c4b2

Please sign in to comment.