Package org.pentaho.reporting.libraries.base.util

Examples of org.pentaho.reporting.libraries.base.util.MemoryByteArrayOutputStream


    final CrosstabGroup ct = (CrosstabGroup) rootGroup;
    ct.setPrintColumnTitleHeader(true);
    ct.setPrintDetailsHeader(false);

    final MemoryByteArrayOutputStream outputStream = new MemoryByteArrayOutputStream();
    HtmlReportUtil.createStreamHTML(report, outputStream);

    final String htmlText = new String(outputStream.toByteArray(), "UTF-8");
    DebugLog.log(htmlText);
    assertTrue(htmlText.contains("<td colspan=\"2\" valign=\"top\" class=\"style-1\">2003</td>"));
    assertTrue(htmlText.contains("<td colspan=\"2\" valign=\"top\" class=\"style-1\">2004</td>"));
    assertTrue(htmlText.contains("<td colspan=\"2\" valign=\"top\" class=\"style-1\">2005</td>"));
    assertTrue(htmlText.contains("<td valign=\"top\" class=\"style-3\">Product Line</td>"));
View Full Code Here


    final CrosstabGroup ct = (CrosstabGroup) rootGroup;
    ct.setPrintColumnTitleHeader(true);
    ct.setPrintDetailsHeader(false);

    final MemoryByteArrayOutputStream outputStream = new MemoryByteArrayOutputStream();
    HtmlReportUtil.createStreamHTML(report, outputStream);

    final String htmlText = new String(outputStream.toByteArray(), "UTF-8");
    DebugLog.log(htmlText);
    assertTrue(htmlText.contains("<td colspan=\"2\" valign=\"top\" class=\"style-1\">2003</td>"));
    assertTrue(htmlText.contains("<td colspan=\"2\" valign=\"top\" class=\"style-1\">2004</td>"));
    assertTrue(htmlText.contains("<td colspan=\"2\" valign=\"top\" class=\"style-1\">2005</td>"));
    assertTrue(htmlText.contains("<td valign=\"top\" class=\"style-3\">Product Line</td>"));
View Full Code Here

    final MasterReport report = new MasterReport();
    final ReportHeader band = report.getReportHeader();
    band.addElement(table);

    final MemoryByteArrayOutputStream outputStream = new MemoryByteArrayOutputStream();
    HtmlReportUtil.createStreamHTML(report, outputStream);

    final String htmlText = new String(outputStream.toByteArray(), "UTF-8");
    assertTrue(htmlText.contains("<td valign=\"top\" class=\"style-1\">header</td>"));
    assertTrue(htmlText.contains("<td valign=\"top\" class=\"style-1\">body</td>"));
  }
View Full Code Here

    assertNotNull(url);
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    final Resource directly = resourceManager.createDirectly(url, MasterReport.class);
    final MasterReport report = (MasterReport) directly.getResource();
    final MemoryByteArrayOutputStream mbos = new MemoryByteArrayOutputStream();
    XmlTableReportUtil.createFlowXML(report, new NoCloseOutputStream(mbos));

    final ByteArrayInputStream bin = new ByteArrayInputStream(mbos.getRaw(), 0, mbos.getLength());
    final DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    final Document document = documentBuilder.parse(bin);
    final NodeList table = document.getDocumentElement().getElementsByTagName("table");
    assertSheetName((Element) table.item(0), "Summary");
    assertSheetName((Element) table.item(1), "AuthorPublisher A");
View Full Code Here

    assertNotNull(url);
    final ResourceManager resourceManager = new ResourceManager();
    resourceManager.registerDefaults();
    final Resource directly = resourceManager.createDirectly(url, MasterReport.class);
    final MasterReport report = (MasterReport) directly.getResource();
    final MemoryByteArrayOutputStream mbos = new MemoryByteArrayOutputStream();
    ExcelReportUtil.createXLS(report, new NoCloseOutputStream(mbos));

    final ByteArrayInputStream bin = new ByteArrayInputStream(mbos.getRaw(), 0, mbos.getLength());
    final Workbook workbook = WorkbookFactory.create(bin);
    assertEquals(4, workbook.getNumberOfSheets());
    assertEquals("Summary", workbook.getSheetAt(0).getSheetName());
    assertEquals("AuthorPublisher A", workbook.getSheetAt(1).getSheetName());
    assertEquals("AuthorPublisher B", workbook.getSheetAt(2).getSheetName());
View Full Code Here

      }

      final InputStream postResult = filePost.getResponseBodyAsStream();
      try
      {
        final MemoryByteArrayOutputStream bout = new MemoryByteArrayOutputStream();
        IOUtils.getInstance().copyStreams(postResult, bout);
        return bout.toByteArray();
      }
      finally
      {
        postResult.close();
      }
View Full Code Here

  }


  protected MasterReport postProcess(final MasterReport originalReport) throws Exception
  {
    final MemoryByteArrayOutputStream bout = new MemoryByteArrayOutputStream();
    BundleWriter.writeReportToZipStream(originalReport, bout);
    assertTrue(bout.getLength() > 0);

    final ResourceManager mgr = new ResourceManager();
    mgr.registerDefaults();
    final Resource reportRes = mgr.createDirectly(bout.toByteArray(), MasterReport.class);
    return (MasterReport) reportRes.getResource();
  }
View Full Code Here

  private byte[] serializeReportObject(final MasterReport report) throws IOException
  {
    // we don't test whether our demo models are serializable :)
    // clear all report properties, which may cause trouble ...
    final MemoryByteArrayOutputStream bo = new MemoryByteArrayOutputStream();
    final ObjectOutputStream oout = new ObjectOutputStream(bo);
    oout.writeObject(report);
    oout.close();
    return bo.toByteArray();
  }
View Full Code Here

  }


  protected MasterReport postProcess(final MasterReport originalReport) throws Exception
  {
    final MemoryByteArrayOutputStream bout = new MemoryByteArrayOutputStream();
    BundleWriter.writeReportToZipStream(originalReport, bout);
    assertTrue(bout.getLength() > 0);

    final ResourceManager mgr = new ResourceManager();
    mgr.registerDefaults();
    final Resource reportRes = mgr.createDirectly(bout.toByteArray(), MasterReport.class);
    return (MasterReport) reportRes.getResource();
  }
View Full Code Here

    final InputStream byteStream = input.getByteStream();
    if (byteStream != null)
    {
      try
      {
        final MemoryByteArrayOutputStream bout = new MemoryByteArrayOutputStream();
        IOUtils.getInstance().copyStreams(byteStream, bout);
        return bout.toByteArray();
      }
      finally
      {
        byteStream.close();
      }
    }

    final Reader characterStream = input.getCharacterStream();
    if (characterStream == null)
    {
      throw new IOException
          ("InputSource has neither an Byte nor a CharacterStream");
    }

    try
    {
      final MemoryByteArrayOutputStream bout = new MemoryByteArrayOutputStream();
      final OutputStreamWriter owriter = new OutputStreamWriter(bout);
      IOUtils.getInstance().copyWriter(characterStream, owriter);
      owriter.close();
      return bout.toByteArray();
    }
    finally
    {
      characterStream.close();
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.base.util.MemoryByteArrayOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.