src/main/java/com/sourcesense/confluence/servlets/CMISProxyServlet.java
private byte[] ungzip(final byte[] gzipped) throws IOException {
    final GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(gzipped));
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(gzipped.length);
    final byte[] buffer = new byte[FOUR_KB];
    int bytesRead = 0;
    while (bytesRead != -1) {
      bytesRead = inputStream.read(buffer, 0, FOUR_KB);
      if (bytesRead != -1) {
        byteArrayOutputStream.write(buffer, 0, bytesRead);
      }
    }
    byte[] ungzipped = byteArrayOutputStream.toByteArray();
    inputStream.close();
    byteArrayOutputStream.close();
    return ungzipped;
  }
/**
   * A highly performant ungzip implementation. Do not refactor this without taking new timings.
   * See ElementTest in ehcache for timings
   *
   * @param gzipped the gzipped content
   * @return an ungzipped byte[]
   * @throws java.io.IOException when something bad happens
   */
A highly performant ungzip implementation. Do not refactor this without taking new timings.
See ElementTest in ehcache for timings

@param gzipped the gzipped content
@return an ungzipped byte[]
@throws java.io.IOException when something bad happens
A highly performant ungzip implementation . Do not refactor this without taking new timings . See ElementTest in ehcache for timings @param gzipped the gzipped content @return an ungzipped byte [] @throws java . io . IOException when something bad happens
private byte[] ungzip(final byte[] gzipped) throws IOException {
    final GZIPInputStream inputStream = new GZIPInputStream(new ByteArrayInputStream(gzipped));
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(gzipped.length);
    final byte[] buffer = new byte[FOUR_KB];
    int bytesRead = 0;
    while (bytesRead != -1) {
      bytesRead = inputStream.read(buffer, 0, FOUR_KB);
      if (bytesRead != -1) {
        byteArrayOutputStream.write(buffer, 0, bytesRead);
      }
    }
    byte[] ungzipped = byteArrayOutputStream.toByteArray();
    inputStream.close();
    byteArrayOutputStream.close();
    return ungzipped;
  }
private byte [ ] ungzip ( final byte [ ] gzipped ) throws IOException { final GZIPInputStream inputStream = new GZIPInputStream ( new ByteArrayInputStream ( gzipped ) ) ; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream ( gzipped . length ) ; final byte [ ] buffer = new byte [ FOUR_KB ] ; int bytesRead = 0 ; while ( bytesRead != - 1 ) { bytesRead = inputStream . read ( buffer , 0 , FOUR_KB ) ; if ( bytesRead != - 1 ) { byteArrayOutputStream . write ( buffer , 0 , bytesRead ) ; } } byte [ ] ungzipped = byteArrayOutputStream . toByteArray ( ) ; inputStream . close ( ) ; byteArrayOutputStream . close ( ) ; return ungzipped ; }
A highly performant ungzip implementation.
A highly performant ungzip implementation .