Package org.pentaho.reporting.engine.classic.core.util

Examples of org.pentaho.reporting.engine.classic.core.util.MemoryByteArrayOutputStream


    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


  public static byte[] encodeImage(final Image image,
                                   final String mimeType,
                                   final float quality,
                                   final boolean alpha) throws UnsupportedEncoderException, IOException
  {
    final MemoryByteArrayOutputStream byteOut = new MemoryByteArrayOutputStream(65536, 65536 * 2);
    encodeImage(byteOut, image, mimeType, quality, alpha);
    return byteOut.toByteArray();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.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.