Package br.net.woodstock.rockframework.io

Examples of br.net.woodstock.rockframework.io.InputOutputStream


      PdfReader reader = new PdfReader(source);
      int pageCount = reader.getNumberOfPages();
      List<InputStream> list = new LinkedList<InputStream>();

      Document document = null;
      InputOutputStream outputStream = null;
      PdfCopy writer = null;
      for (int i = 1; i <= pageCount; i++) {
        if ((document == null) || ((i % size) == 0)) {
          if (document != null) {
            document.close();
            writer.close();
            list.add(outputStream.getInputStream());
          }
          document = new Document(reader.getPageSizeWithRotation(1));
          outputStream = new InputOutputStream();
          writer = new PdfCopy(document, outputStream);
        }
        PdfImportedPage page = writer.getImportedPage(reader, i);
        writer.addPage(page);
      }

      if (document != null) {
        document.close();
        writer.close();
        list.add(outputStream.getInputStream());
      }

      reader.close();

      return list.toArray(new InputStream[list.size()]);
View Full Code Here


    return IOUtils.gzip(new ByteArrayInputStream(bytes));
  }

  public static InputStream gzip(final InputStream inputStream) throws IOException {
    Assert.notNull(inputStream, "inputStream");
    InputOutputStream inputOutputStream = new InputOutputStream();
    GZIPOutputStream gzipOutputStream = new GZIPOutputStream(inputOutputStream);
    IOUtils.copy(inputStream, gzipOutputStream);

    gzipOutputStream.close();
    return inputOutputStream.getInputStream();
  }
View Full Code Here

  }

  public static InputStream gunzip(final InputStream inputStream) throws IOException {
    Assert.notNull(inputStream, "inputStream");
    GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
    InputOutputStream inputOutputStream = new InputOutputStream();
    IOUtils.copy(gzipInputStream, inputOutputStream);
    return inputOutputStream.getInputStream();
  }
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.io.InputOutputStream

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.