protected static IOFileFilter getFileFilter() {
return FileFilterUtils.and(
FileFilterUtils.fileFileFilter(),
- new WildcardFileFilter(
- new String[] {"*.ttf", "*.otf", "*.pfb", "*.ttc"},
- IOCase.INSENSITIVE)
- );
+ WildcardFileFilter.builder().setIoCase(IOCase.INSENSITIVE)
+ .setWildcards("*.ttf", "*.otf", "*.pfb", "*.ttc").get());
}
/**
userAgent.setAccessibility(true);
eventChecker = new MissingLanguageEventChecker();
userAgent.getEventBroadcaster().addEventListener(eventChecker);
- fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.NULL_OUTPUT_STREAM);
+ fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.INSTANCE);
}
@Test
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.getEventBroadcaster().addEventListener(eventChecker);
- Fop fop = fopFactory.newFop(mimeType, userAgent, NullOutputStream.NULL_OUTPUT_STREAM);
+ Fop fop = fopFactory.newFop(mimeType, userAgent, NullOutputStream.INSTANCE);
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, NullOutputStream.NULL_OUTPUT_STREAM);
+ fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, NullOutputStream.INSTANCE);
Source src = new StreamSource(new FileInputStream("test/events/flowNameNotMapped.fo"));
SAXResult res = new SAXResult(fop.getDefaultHandler());
Transformer transformer = TransformerFactory.newInstance().newTransformer();
@Test
public void testFontCacheWithThreads() throws Exception {
PrintStream old = System.err;
- System.setErr(new NullPrintStream());
+ System.setErr(NullPrintStream.INSTANCE);
ExecutorService executor = Executors.newFixedThreadPool(10);
for (int i = 0; i < 100000; i++) {
executor.submit(new FontTask());
out = new FileOutputStream(tgtFile);
out = new BufferedOutputStream(out);
} else {
- out = NullOutputStream.NULL_OUTPUT_STREAM;
+ out = NullOutputStream.INSTANCE;
}
try {
Source src = new DOMSource(intermediate);
Transformer transformer = replicatorTemplates.newTransformer();
transformer.setParameter("repeats", replicatorRepeats);
- OutputStream out = NullOutputStream.NULL_OUTPUT_STREAM; //write to /dev/nul
+ OutputStream out = NullOutputStream.INSTANCE; //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, NullOutputStream.NULL_OUTPUT_STREAM);
+ ua, MimeConstants.MIME_PDF, NullOutputStream.INSTANCE);
assertTrue(foEventHandler instanceof AreaTreeHandler);
ua = fopFactory.newFOUserAgent();
foEventHandler = factory.createFOEventHandler(
- ua, MimeConstants.MIME_RTF, NullOutputStream.NULL_OUTPUT_STREAM);
+ ua, MimeConstants.MIME_RTF, NullOutputStream.INSTANCE);
assertTrue(foEventHandler instanceof RTFHandler);
ua = fopFactory.newFOUserAgent();
try {
foEventHandler = factory.createFOEventHandler(
- ua, "invalid/format", NullOutputStream.NULL_OUTPUT_STREAM);
+ ua, "invalid/format", NullOutputStream.INSTANCE);
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException uoe) {
//expected
}
ua = fopFactory.newFOUserAgent();
- overrideFOEventHandler = new RTFHandler(ua, NullOutputStream.NULL_OUTPUT_STREAM);
+ overrideFOEventHandler = new RTFHandler(ua, NullOutputStream.INSTANCE);
ua.setFOEventHandlerOverride(overrideFOEventHandler);
foEventHandler = factory.createFOEventHandler(
ua, null, null);
File outfile = new File(outputDir, df.format(num) + fop.getTargetFileExtension());
OutputStream out;
if (writeToDevNull) {
- out = NullOutputStream.NULL_OUTPUT_STREAM;
+ out = NullOutputStream.INSTANCE;
} else {
out = new java.io.FileOutputStream(outfile);
out = new java.io.BufferedOutputStream(out);
manualFilter = manualFilter + '*';
}
filter = new AndFileFilter(
- new WildcardFileFilter(manualFilter), filter);
+ WildcardFileFilter.builder().setWildcards(manualFilter).get(), filter);
}
int maxfiles = cfg.getChild("max-files").getValueAsInteger(-1);