public String getDescription(Resource resource) { return target.resolvedPathFor(resource); }
private InputStream copySourceHtml(Resource resource, InputStream inputStream) throws IOException { Resource sourceHtmlResource = new Resource(resource.getPath() + ".html"); System.out.println(SimpleFormatter.format("[Source: %s]", copySourceHtmlTarget.resolvedPathFor(sourceHtmlResource))); String html = asString(inputStream); copySourceHtmlTarget.write(sourceHtmlResource, html); inputStream = new ByteArrayInputStream(html.getBytes("UTF-8")); return inputStream; } }
private void copyResources(Source resourceSource) { for (Entry<String, Resource> resourceToCopy : resourceToCopyMap.entrySet()) { String sourcePath = resourceToCopy.getKey(); Resource targetResource = resourceToCopy.getValue(); try { InputStream inputStream = resourceSource.createInputStream(new Resource(sourcePath)); target.copyTo(targetResource, inputStream); } catch (IOException e) { throw new RuntimeException("Failed to copy " + sourcePath + " to target " + targetResource, e); } } }
public void afterProcessingSpecification(SpecificationProcessingEvent event) { try { target.write(event.getResource(), XML_DECLARATION + event.getRootElement().toXML()); } catch (IOException e) { throw new RuntimeException("Failed to write results to '" + event.getResource().getPath() + "'.", e); } }
private InputStream copySourceHtml(Resource resource, InputStream inputStream) throws IOException { Resource sourceHtmlResource = new Resource(resource.getPath() + ".html"); System.out.println(SimpleFormatter.format("[Source: %s]", copySourceHtmlTarget.resolvedPathFor(sourceHtmlResource))); String html = asString(inputStream); copySourceHtmlTarget.write(sourceHtmlResource, html); inputStream = new ByteArrayInputStream(html.getBytes("UTF-8")); return inputStream; } }
private void copyResources(Source resourceSource) { for (Entry<String, Resource> resourceToCopy : resourceToCopyMap.entrySet()) { String sourcePath = resourceToCopy.getKey(); Resource targetResource = resourceToCopy.getValue(); try { InputStream inputStream = resourceSource.createInputStream(new Resource(sourcePath)); target.copyTo(targetResource, inputStream); } catch (IOException e) { throw new RuntimeException("Failed to copy " + sourcePath + " to target " + targetResource, e); } } }
public void afterProcessingSpecification(SpecificationProcessingEvent event) { try { target.write(event.getResource(), XML_DECLARATION + event.getRootElement().toXML()); } catch (IOException e) { throw new RuntimeException("Failed to write results to '" + event.getResource().getPath() + "'.", e); } }
private void createResourceInTarget() { try { target.copyTo(new Resource("/resource/my.txt"), new ByteArrayInputStream("success".getBytes())); } catch (IOException e) { e.printStackTrace(); } } }
public String getDescription(Resource resource) { return target.resolvedPathFor(resource); }