* @return IOFileFilter font directory filter
*/
protected static IOFileFilter getDirectoryFilter() {
- return FileFilterUtils.andFileFilter(
+ return FileFilterUtils.and(
FileFilterUtils.directoryFileFilter(),
FileFilterUtils.notFileFilter(FileFilterUtils.prefixFileFilter("."))
);
* @return IOFileFilter font file filter
*/
protected static IOFileFilter getFileFilter() {
- return FileFilterUtils.andFileFilter(
+ return FileFilterUtils.and(
FileFilterUtils.fileFileFilter(),
new WildcardFileFilter(
new String[] {"*.ttf", "*.otf", "*.pfb", "*.ttc"},
userAgent.setAccessibility(true);
eventChecker = new MissingLanguageEventChecker();
userAgent.getEventBroadcaster().addEventListener(eventChecker);
- fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream());
+ fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.NULL_OUTPUT_STREAM);
}
@Test
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.getEventBroadcaster().addEventListener(eventChecker);
- Fop fop = fopFactory.newFop(mimeType, userAgent, new NullOutputStream());
+ Fop fop = fopFactory.newFop(mimeType, userAgent, NullOutputStream.NULL_OUTPUT_STREAM);
Transformer transformer = tFactory.newTransformer();
Source src = new StreamSource(inStream);
Result res = new SAXResult(fop.getDefaultHandler());
FOUserAgent userAgent = fopFactory.newFOUserAgent();
flowChecker = new FlowNameNotMappedEventChecker();
userAgent.getEventBroadcaster().addEventListener(flowChecker);
- fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new NullOutputStream());
+ fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.NULL_OUTPUT_STREAM);
Source src = new StreamSource(new FileInputStream("test/events/flowNameNotMapped.fo"));
SAXResult res = new SAXResult(fop.getDefaultHandler());
Transformer transformer = TransformerFactory.newInstance().newTransformer();
out = new FileOutputStream(tgtFile);
out = new BufferedOutputStream(out);
} else {
- out = new NullOutputStream();
+ out = NullOutputStream.NULL_OUTPUT_STREAM;
}
try {
Source src = new DOMSource(intermediate);
Transformer transformer = replicatorTemplates.newTransformer();
transformer.setParameter("repeats", replicatorRepeats);
- OutputStream out = new NullOutputStream(); //write to /dev/nul
+ OutputStream out = NullOutputStream.NULL_OUTPUT_STREAM; //write to /dev/nul
try {
FOUserAgent userAgent = fopFactory.newFOUserAgent();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
ua = fopFactory.newFOUserAgent();
foEventHandler = factory.createFOEventHandler(
- ua, MimeConstants.MIME_PDF, new NullOutputStream());
+ ua, MimeConstants.MIME_PDF, NullOutputStream.NULL_OUTPUT_STREAM);
assertTrue(foEventHandler instanceof AreaTreeHandler);
ua = fopFactory.newFOUserAgent();
foEventHandler = factory.createFOEventHandler(
- ua, MimeConstants.MIME_RTF, new NullOutputStream());
+ ua, MimeConstants.MIME_RTF, NullOutputStream.NULL_OUTPUT_STREAM);
assertTrue(foEventHandler instanceof RTFHandler);
ua = fopFactory.newFOUserAgent();
try {
foEventHandler = factory.createFOEventHandler(
- ua, "invalid/format", new NullOutputStream());
+ ua, "invalid/format", NullOutputStream.NULL_OUTPUT_STREAM);
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException uoe) {
//expected
}
ua = fopFactory.newFOUserAgent();
- overrideFOEventHandler = new RTFHandler(ua, new NullOutputStream());
+ overrideFOEventHandler = new RTFHandler(ua, NullOutputStream.NULL_OUTPUT_STREAM);
ua.setFOEventHandlerOverride(overrideFOEventHandler);
foEventHandler = factory.createFOEventHandler(
ua, null, null);
+ "rotate=\"30 30 0 15\">Hello SVG with FOP</text>\n"
+ "</svg>";
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(null);
- Document doc = factory.createDocument(null, IOUtils.toInputStream(svg));
+ Document doc = factory.createDocument(null, IOUtils.toInputStream(svg, "utf-8"));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
new PSImageHandlerSVG().handleImage(
new PSRenderingContext(ua, new PSGenerator(bos), new FontInfo()),
svgGraphics2D.setGraphicContext(new GraphicContext());
svgGraphics2D.translate(100, 100);
svgGraphics2D.applyPaint(gradient, true);
- String expected = IOUtils.toString(getClass().getResourceAsStream(expectedResourceName));
+ String expected = IOUtils.toString(getClass().getResourceAsStream(expectedResourceName), "utf-8");
assertEquals(expected.replace("\r", ""), out.toString());
}
File outfile = new File(outputDir, df.format(num) + fop.getTargetFileExtension());
OutputStream out;
if (writeToDevNull) {
- out = new NullOutputStream();
+ out = NullOutputStream.NULL_OUTPUT_STREAM;
} else {
out = new java.io.FileOutputStream(outfile);
out = new java.io.BufferedOutputStream(out);