/** * Unpack report face to given directory. * * @param outputDirectory the output directory to unpack face. * @throws IOException if any occurs. */ private static void unpackFace(File outputDirectory) throws IOException { ClassLoader loader = AllureMain.class.getClassLoader(); for (ClassPath.ResourceInfo info : ClassPath.from(loader).getResources()) { Matcher matcher = REPORT_RESOURCE_PATTERN.matcher(info.getResourceName()); if (matcher.find()) { String resourcePath = matcher.group(1); File dest = new File(outputDirectory, resourcePath); Files.createParentDirs(dest); try (FileOutputStream output = new FileOutputStream(dest); InputStream input = info.url().openStream()) { IOUtils.copy(input, output); LOGGER.debug("{} successfully copied.", resourcePath); } } } } }
/** * Returns a {@link CharSource} view of the resource from which its bytes can be read as * characters decoded with the given {@code charset}. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final CharSource asCharSource(Charset charset) { return Resources.asCharSource(url(), charset); }
/** * Returns a {@link ByteSource} view of the resource from which its bytes can be read. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final ByteSource asByteSource() { return Resources.asByteSource(url()); }
/** * Returns a {@link CharSource} view of the resource from which its bytes can be read as * characters decoded with the given {@code charset}. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final CharSource asCharSource(Charset charset) { return Resources.asCharSource(url(), charset); }
/** * Returns a {@link ByteSource} view of the resource from which its bytes can be read. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final ByteSource asByteSource() { return Resources.asByteSource(url()); }
/** * Returns a {@link CharSource} view of the resource from which its bytes can be read as * characters decoded with the given {@code charset}. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final CharSource asCharSource(Charset charset) { return Resources.asCharSource(url(), charset); }
/** * Returns a {@link ByteSource} view of the resource from which its bytes can be read. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final ByteSource asByteSource() { return Resources.asByteSource(url()); }
/** * Returns a {@link CharSource} view of the resource from which its bytes can be read as * characters decoded with the given {@code charset}. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final CharSource asCharSource(Charset charset) { return Resources.asCharSource(url(), charset); }
/** * Returns a {@link ByteSource} view of the resource from which its bytes can be read. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final ByteSource asByteSource() { return Resources.asByteSource(url()); }
/** * Returns a {@link ByteSource} view of the resource from which its bytes can be read. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final ByteSource asByteSource() { return Resources.asByteSource(url()); }
/** * Returns a {@link CharSource} view of the resource from which its bytes can be read as * characters decoded with the given {@code charset}. * * @throws NoSuchElementException if the resource cannot be loaded through the class loader, * despite physically existing in the class path. * @since 20.0 */ public final CharSource asCharSource(Charset charset) { return Resources.asCharSource(url(), charset); }