pdf/src/main/java/se/idsec/signservice/integration/document/pdf/visiblesig/VisibleSignatureImageSerializer.java
private static byte[] compress(final byte[] data) throws IOException {
    final Deflater deflater = new Deflater();
    deflater.setInput(data);
    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
    deflater.finish();
    final byte[] buffer = new byte[1024];
    while (!deflater.finished()) {
      final int count = deflater.deflate(buffer); // returns the generated code... index
      outputStream.write(buffer, 0, count);
    }
    outputStream.close();
    return outputStream.toByteArray();
  }
/**
   * Compression of the supplied data.
   *
   * @param data
   *          data to compress
   * @return compressed data
   * @throws IOException
   *           on invalid input
   */
Compression of the supplied data.
@param data
data to compress
@return compressed data
@throws IOException
on invalid input
Compression of the supplied data . @param data data to compress @return compressed data @throws IOException on invalid input
private static byte[] compress(final byte[] data) throws IOException {
    final Deflater deflater = new Deflater();
    deflater.setInput(data);
    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(data.length);
    deflater.finish();
    final byte[] buffer = new byte[1024];
    while (!deflater.finished()) {
      final int count = deflater.deflate(buffer); 
      outputStream.write(buffer, 0, count);
    }
    outputStream.close();
    return outputStream.toByteArray();
  }
private static byte [ ] compress ( final byte [ ] data ) throws IOException { final Deflater deflater = new Deflater ( ) ; deflater . setInput ( data ) ; final ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( data . length ) ; deflater . finish ( ) ; final byte [ ] buffer = new byte [ 1024 ] ; while ( ! deflater . finished ( ) ) { final int count = deflater . deflate ( buffer ) ; outputStream . write ( buffer , 0 , count ) ; } outputStream . close ( ) ; return outputStream . toByteArray ( ) ; }
Compression of the supplied data.
Compression of the supplied data .
// returns the generated code... index