/** * Returns a NullOutputStream that ignores all content given to it. * * @return the output stream. */ public OutputStream getOutputStream() { return new NullOutputStream(); }
private boolean isKeySerializable( final ResourceKey key ) { try { final ObjectOutputStream oout = new ObjectOutputStream( new NullOutputStream() ); oout.writeObject( key ); oout.close(); return true; } catch ( Exception e ) { return false; } }
public SerializedObjectContainer( final Object[] data ) { if ( data == null ) { throw new NullPointerException(); } this.data = data.clone(); // some paranoid checks .. try { final DebuggingObjectOutputStream objectOutputStream = new DebuggingObjectOutputStream( new NullOutputStream() ); try { objectOutputStream.writeObject( this ); } catch ( NotSerializableException nse ) { logger.debug( "Non-Serializable object found @Path: " + objectOutputStream.getStack() ); // NON-NLS throw nse; } } catch ( IOException e ) { throw new IllegalStateException( "Object is not serializable." ); } }
public static void createRTF( final MasterReport report ) throws Exception { try { RTFReportUtil.createRTF( report, new NullOutputStream() ); } catch ( IndexOutOfBoundsException ibe ) { // this is a known iText bug that does not get fixed. } catch ( ReportParameterValidationException p ) { // reports that have mandatory parameters are ok to fail. Assert.fail(); } }
public static void createDataCSV( final MasterReport report ) throws Exception { try { CSVDataReportUtil.createCSV( report, new NullOutputStream(), "UTF-8" ); } catch ( ReportParameterValidationException e ) { Assert.fail(); } }
public static void createStreamHTML( final MasterReport report ) throws Exception { try { HtmlReportUtil.createStreamHTML( report, new NullOutputStream() ); } catch ( ReportParameterValidationException e ) { Assert.fail(); } }
public static boolean createPlainText( final MasterReport report ) { try { PlainTextReportUtil.createPlainText( report, new NullOutputStream(), 10, 15 ); return true; } catch ( ReportParameterValidationException p ) { return true; } catch ( Exception rpe ) { logger.debug( "Failed to execute plain text: ", rpe ); Assert.fail(); return false; } }
public static void createCSV( final MasterReport report ) throws Exception { try { CSVReportUtil.createCSV( report, new NullOutputStream(), null ); } catch ( ReportParameterValidationException e ) { Assert.fail(); } }
public static void createDataXML( final MasterReport report ) throws Exception { try { final XMLProcessor pr = new XMLProcessor( report ); final Writer fout = new BufferedWriter( new OutputStreamWriter( new NullOutputStream(), "UTF-8" ) ); pr.setWriter( fout ); pr.processReport(); fout.flush(); } catch ( ReportParameterValidationException e ) { Assert.fail(); } }
public static void createXLS( final MasterReport report ) throws Exception { try { ExcelReportUtil.createXLS( report, new NullOutputStream() ); } catch ( ReportParameterValidationException e ) { Assert.fail(); } }
public static void createZIPHTML( final MasterReport report ) throws Exception { try { HtmlReportUtil.createZIPHTML( report, new NullOutputStream(), "report.html" ); } catch ( ReportParameterValidationException e ) { Assert.fail(); } }
public static void createXmlFlow( final MasterReport report ) throws Exception { XmlTableReportUtil.createFlowXML( report, new NullOutputStream() ); }
public static void createXmlPageable( final MasterReport report ) throws Exception { XmlPageReportUtil.createXml( report, new NullOutputStream() ); }
public static void createXmlStream( final MasterReport report ) throws Exception { XmlTableReportUtil.createStreamXML( report, new NullOutputStream() ); }
public static List<LogicalPageBox> layoutPages( final MasterReport report, final int... page ) throws Exception { final LocalFontRegistry localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); final InterceptingXmlPageOutputProcessor outputProcessor = new InterceptingXmlPageOutputProcessor( new NullOutputStream(), new XmlPageOutputProcessorMetaData( localFontRegistry ) ); outputProcessor.setFlowSelector( new MultiPageFlowSelector( false, page ) ); final PageableReportProcessor proc = new PageableReportProcessor( report, outputProcessor ); proc.processReport(); List<LogicalPageBox> pages = outputProcessor.getPages(); Assert.assertEquals( "Pages have been generated", page.length, pages.size() ); return pages; }
public static List<LogicalPageBox> layoutPagesStrict( final MasterReport report, final int maxPage, final int... page ) throws Exception { final LocalFontRegistry localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); final InterceptingXmlPageOutputProcessor outputProcessor = new InterceptingXmlPageOutputProcessor( new NullOutputStream(), new XmlPageOutputProcessorMetaData( localFontRegistry ) ); outputProcessor.setFlowSelector( new StrictMultiPageFlowSelector( false, maxPage, page ) ); final PageableReportProcessor proc = new PageableReportProcessor( report, outputProcessor ); proc.processReport(); List<LogicalPageBox> pages = outputProcessor.getPages(); Assert.assertEquals( "Pages have been generated", page.length, pages.size() ); return pages; }
public void testPageSize() throws IOException { final TextFilePrinterDriver pc = new TextFilePrinterDriver( new NullOutputStream(), 12, 12 ); final Paper paper = PageFormatFactory.getInstance().createPaper( PageSize.A4 ); pc.startPage( paper, "ASCII" ); final PlainTextPage page = new PlainTextPage( paper, pc, "ASCII" ); final int width = page.getWidth(); final int height = page.getHeight(); assertEquals( 99, width ); assertEquals( 140, height ); } }
public static LogicalPageBox layoutPage( final MasterReport report, final int page ) throws Exception { final LocalFontRegistry localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); final InterceptingXmlPageOutputProcessor outputProcessor = new InterceptingXmlPageOutputProcessor( new NullOutputStream(), new XmlPageOutputProcessorMetaData( localFontRegistry ) ); outputProcessor.setFlowSelector( new SinglePageFlowSelector( page, false ) ); final PageableReportProcessor proc = new PageableReportProcessor( report, outputProcessor ); proc.processReport(); if ( outputProcessor.getLogicalPageBox() == null ) { Assert.fail( "Did not find the requested page" ); } return outputProcessor.getLogicalPageBox(); }
public static LogicalPageBox layoutTablePage( final MasterReport report, final int page ) throws Exception { final LocalFontRegistry localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); final InterceptingXmlTableOutputProcessor outputProcessor = new InterceptingXmlTableOutputProcessor( new NullOutputStream(), new XmlTableOutputProcessorMetaData( XmlTableOutputProcessorMetaData.PAGINATION_MANUAL, localFontRegistry ) ); outputProcessor.setFlowSelector( new SinglePageFlowSelector( page, true ) ); final ReportProcessor proc = new FlowReportProcessor( report, outputProcessor ); proc.processReport(); if ( outputProcessor.getLogicalPageBox() == null ) { Assert.fail( "Did not find the requested page" ); } return outputProcessor.getLogicalPageBox(); }
public static LogicalPageBox layoutPageStrict( final MasterReport report, final int maxPage, final int page ) throws Exception { final LocalFontRegistry localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); final InterceptingXmlPageOutputProcessor outputProcessor = new InterceptingXmlPageOutputProcessor( new NullOutputStream(), new XmlPageOutputProcessorMetaData( localFontRegistry ) ); outputProcessor.setFlowSelector( new StrictMultiPageFlowSelector( false, maxPage, page ) ); final PageableReportProcessor proc = new PageableReportProcessor( report, outputProcessor ); proc.processReport(); if ( outputProcessor.getLogicalPageBox() == null ) { Assert.fail( "Did not find the requested page" ); } return outputProcessor.getLogicalPageBox(); }