From b29c4b2372fd8358c38bbe3c3c2d9ccd44b8b484 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 1 Dec 2022 12:06:27 +0300 Subject: [PATCH] #191 extra ctors --- src/main/java/com/jcabi/xml/XSLDocument.java | 52 ++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/jcabi/xml/XSLDocument.java b/src/main/java/com/jcabi/xml/XSLDocument.java index 14eec80..ba0f379 100644 --- a/src/main/java/com/jcabi/xml/XSLDocument.java +++ b/src/main/java/com/jcabi/xml/XSLDocument.java @@ -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); } /** @@ -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); } /** @@ -195,6 +218,18 @@ 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 @@ -202,7 +237,18 @@ public XSLDocument(final Path file) throws FileNotFoundException { * @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); } /**