Examples of GZIPInputStream


Examples of java.util.zip.GZIPInputStream

      // check if its gzipped
      if ("gzip".equalsIgnoreCase(connection.getContentEncoding())) {
        //is = new GZIPInputStream( new BufferedInputStream(is, 1024));
        //is = new GZIPInputStream(is);
        is = new BufferedInputStream(new GZIPInputStream(is), 1000);
      }
      return is;

    } catch (java.net.ConnectException e) {
      if (showStackTrace) e.printStackTrace();
View Full Code Here

Examples of java.util.zip.GZIPInputStream

    }

    private void setupDecompressionInputStream(StreamMessageContext ctx) {
        try {
           
            GZIPInputStream zipIn = new GZIPInputStream(ctx.getInputStream());
            ctx.setInputStream(zipIn);
        } catch (IOException ex) {
            throw new ProtocolException(ex);
        }
    }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

    }

    protected InputStream doGetInputStream() throws Exception
    {
        InputStream is = getContainer().getContent().getInputStream();
        return new GZIPInputStream(is);
    }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

    }

    /* Create the GZipInputStream then */
    if (isGzipStream) {
      try {
        return new GZIPInputStream(inputStream);
      } catch (IOException e) {
        return inputStream;
      }
    }
    return inputStream;
View Full Code Here

Examples of java.util.zip.GZIPInputStream

        isGzipStream = true;
    }

    /* Create the GZipInputStream then */
    if (isGzipStream)
      return new GZIPInputStream(inputStream);
    return inputStream;
  }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

        if ( compressed )
        {
            if ( !logger.isLoggable( Level.FINEST ) )
            {
                return adapter
                        .read( new UncloseableInputStream( new GZIPInputStream( in, EJConstants.BUFFERED_STREAM_SIZE ),
                                                           adapter.requiresCustomEOFHandling() ) );
            }
            else
            {
                return adapter
                        .read( new LoggingInputStream(
                                                       new UncloseableInputStream(
                                                                                   new GZIPInputStream(
                                                                                                        in,
                                                                                                        EJConstants.BUFFERED_STREAM_SIZE ),
                                                                                   adapter.requiresCustomEOFHandling() ) ) );
            }
        }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

        log.debug("State was on client")
      }
     
      Object state = null;
      ByteArrayInputStream bis = null;
      GZIPInputStream gis = null;
      ObjectInputStream ois = null;

      byte[] bytes =Base64.decodeBase64(viewString.getBytes());
      bis = new ByteArrayInputStream(bytes);

      try {
        gis = new GZIPInputStream(bis);
        ois = new ObjectInputStream(gis);
        
        structure = ois.readObject();
        state = ois.readObject();
        // store the state object temporarily in ThreadLocal viewStateData scope
        // until it is processed by getComponentStateToRestore
        // which resets it.
        viewStateData.set(state);       
        bis.close();
        gis.close();
      } catch (IOException e) {
        log.error(e.getMessage(),e);
      } catch (ClassNotFoundException e) {
        log.error(e.getMessage(),e);
      }
View Full Code Here

Examples of java.util.zip.GZIPInputStream

         GetMethod get = new GetMethod("http://localhost:8080/resteasy/gzip");
         get.addRequestHeader("Accept-Encoding", "gzip, deflate");
         int status = client.executeMethod(get);
         Assert.assertEquals(200, status);
         Assert.assertEquals("gzip", get.getResponseHeader("Content-Encoding").getValue());
         GZIPInputStream gzip = new GZIPInputStream(get.getResponseBodyAsStream());
         String response = readString(gzip);


         // test that it is actually zipped
         Assert.assertEquals(response, "HELLO WORLD");
View Full Code Here

Examples of java.util.zip.GZIPInputStream

      }
    }
  }

  protected void pageIn(JRVirtualizable o) throws IOException {
    GZIPInputStream gis = null;
    try {
      byte[] data = (byte[]) zippedData.get(o.getUID());
      if (data == null) {
        throw new JRRuntimeException("No data found for object with UID " + o.getUID());
      }
      ByteArrayInputStream bais = new ByteArrayInputStream(data);
      gis = new GZIPInputStream(bais);
      readData(o, gis);
    }
    finally {
      if (gis != null) {
        gis.close();
      }
    }

    if (!isReadOnly(o)) {
      // Wait until we know it worked before tossing the data.
View Full Code Here

Examples of java.util.zip.GZIPInputStream

     * @throws IOException
     */
    static byte[] decompress(byte[] compressedData) throws IOException {
       
        ByteArrayInputStream bis = new ByteArrayInputStream(compressedData);
        GZIPInputStream in = new GZIPInputStream(bis);
       
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
       
        byte[] transferBuffer = new byte[4096];
        int read = 0;
        do {
            read = in.read(transferBuffer);
            if (read != -1) {
                bos.write(transferBuffer, 0, read);
            }
        } while (read != -1);
        in.close();
               
        in.close();
        bos.close();
       
        return bos.toByteArray();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.