public static String decodeBase64ZippedString( String loggingString64 ) throws IOException {
    if ( loggingString64 == null || loggingString64.isEmpty() ) {
      return "";
    }
    StringWriter writer = new StringWriter();
    // base 64 decode
    byte[] bytes64 = Base64.decodeBase64( loggingString64.getBytes() );
    // unzip to string encoding-wise
    ByteArrayInputStream zip = new ByteArrayInputStream( bytes64 );

    // PDI-4325 originally used xml encoding in servlet
    try ( GZIPInputStream unzip = new GZIPInputStream( zip, HttpUtil.ZIP_BUFFER_SIZE );
           BufferedInputStream in = new BufferedInputStream( unzip, HttpUtil.ZIP_BUFFER_SIZE );
           InputStreamReader reader = new InputStreamReader( in, Const.XML_ENCODING ) ) {

      // use same buffer size
      char[] buff = new char[ HttpUtil.ZIP_BUFFER_SIZE ];
      for ( int length; ( length = reader.read( buff ) ) > 0; ) {
        writer.write( buff, 0, length );
      }
    }
    return writer.toString();
  }
@Test
  public final void testDecodeBase64ZippedString() throws IOException, NoSuchAlgorithmException {
    String enc64 = this.canonicalBase64Encode( STANDART );
    // decode string
    String decoded = HttpUtil.decodeBase64ZippedString( enc64 );

    Assert.assertEquals( "Strings are the same after transformation", STANDART, decoded );
  }