Package java.util.zip

Examples of java.util.zip.GZIPOutputStream


        super(db, file, includeCached, true, false);

        try {
            fileStreamOut = crypto.getOutputStream(fileStreamOut);
            fileStreamOut = new GZIPOutputStream(fileStreamOut);
        } catch (IOException e) {
            throw Error.error(e, ErrorCode.FILE_IO_ERROR,
                              ErrorCode.M_Message_Pair, new Object[] {
                e.getMessage(), outFile
            });
View Full Code Here


      // Output stream to write to when buffering is needed.
      OutputStream buos = null;
      // The buffer.
      ByteArrayOutputStream baos = null;
      // Filter on top of the buffer when gzip:ing.
      GZIPOutputStream gzos = null;

      final int contentLength = resource.getContentLength();
      if (contentLength > 0 && !useGzip) {
        response.setContentLength(contentLength);
      } else {
        final int size = contentLength>0 ? contentLength+25 : 512;
        buos = baos = new ByteArrayOutputStream(size);
        if (useGzip) {
          gzos = new GZIPOutputStream(baos);
          buos = gzos;
        }
      }

      final InputStream is = resource.getInputStream();
      final OutputStream os = response.getOutputStream();

      int bytesRead = 0;
      final byte buffer[] = new byte[512];
      while((bytesRead = is.read(buffer)) != -1) {
        if (null==buos) {
          os.write(buffer, 0, bytesRead);
        } else {
          // Buffer data to be able to compute the true content length
          buos.write(buffer, 0, bytesRead);
          totalBytesRead += bytesRead;
        }
      }
      if (null!=buos) {
        if (null!=gzos) { //Content-Encoding: gzip
          gzos.finish();
          response.addHeader(HeaderBase.CONTENT_ENCODING, "gzip");
          response.setContentLength(baos.size());
          baos.writeTo(os);
        } else { // Initially unknown content length.
          if(totalBytesRead > 0) {
View Full Code Here

      byte[] payload = out.toByteArray();
     
     
      //GZip
      ByteArrayOutputStream byteGzipOut = new ByteArrayOutputStream();
        GZIPOutputStream gZipOut = new GZIPOutputStream(byteGzipOut);
       
        gZipOut.write(payload);
        gZipOut.close();
       
       
        //BZip2
//      ByteArrayOutputStream bytebzip2Out = new ByteArrayOutputStream();
//        CBZip2OutputStream bZip2Out = new CBZip2OutputStream(bytebzip2Out);
View Full Code Here

      byte[] payload = out.toByteArray();
     
     
      //GZip
      ByteArrayOutputStream byteGzipOut = new ByteArrayOutputStream();
        GZIPOutputStream gZipOut = new GZIPOutputStream(byteGzipOut);
       
        gZipOut.write(payload);
        gZipOut.close();
       
       
        //BZip2
//      ByteArrayOutputStream bytebzip2Out = new ByteArrayOutputStream();
//        CBZip2OutputStream bZip2Out = new CBZip2OutputStream(bytebzip2Out);
View Full Code Here

      byte[] payload = out.toByteArray();
     
     
      //GZip
      ByteArrayOutputStream byteGzipOut = new ByteArrayOutputStream();
        GZIPOutputStream gZipOut = new GZIPOutputStream(byteGzipOut);
       
        gZipOut.write(payload);
        gZipOut.close();
       
       
        //BZip2
//      ByteArrayOutputStream bytebzip2Out = new ByteArrayOutputStream();
//        CBZip2OutputStream bZip2Out = new CBZip2OutputStream(bytebzip2Out);
View Full Code Here

         
          byte[] payload = out.toByteArray();
         
          //GZip
          ByteArrayOutputStream byteGzipOut = new ByteArrayOutputStream();
            GZIPOutputStream gZipOut = new GZIPOutputStream(byteGzipOut);
           
            gZipOut.write(payload);
            gZipOut.close();
           
            image.flush();
            if (img!=null)img.flush();
           
            log.debug("byteGzipOut LENGTH "+byteGzipOut.toByteArray().length);
View Full Code Here

           
            byte[] payload = out.toByteArray();
           
            //GZip
            ByteArrayOutputStream byteGzipOut = new ByteArrayOutputStream();
              GZIPOutputStream gZipOut = new GZIPOutputStream(byteGzipOut);
             
              gZipOut.write(payload);
              gZipOut.close();
             
              log.debug("byteGzipOut LENGTH "+byteGzipOut.toByteArray().length);
            log.debug("payload LENGTH "+payload.length);
           
            log.debug("TILE x,y "+shrinkedRectAngle.x+" "+shrinkedRectAngle.y);
           
            clientImageFrames.add(new ClientImageFrame(shrinkedRectAngle,byteGzipOut.toByteArray()));
           
            image.flush();
              img.flush();
            byteGzipOut.flush();
            gZipOut.flush();
           
          }
         
          counter++;
         
View Full Code Here

    protected void define(String name, byte[] data) {
        defineClass(name, data, 0, data.length);
        if (mGZippedBytecode != null) {
            try {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                GZIPOutputStream gz = new GZIPOutputStream(baos);
                gz.write(data,0,data.length);
                gz.close();
                mGZippedBytecode.put(name.replace('.','/') + ".class",
                                     baos.toByteArray());
            }
            catch (IOException ioe) {
                ioe.printStackTrace();
View Full Code Here

        //payload = clientImageFrameModus.getPayload();
      }
     
      //GZip
      ByteArrayOutputStream byteGzipOut = new ByteArrayOutputStream();
        GZIPOutputStream gZipOut = new GZIPOutputStream(byteGzipOut);
       
        gZipOut.write(payload);
        gZipOut.close();
       
        log.debug("SEND NEW FRAME "+clientImageFrameModus.getRect().getX()+" "+clientImageFrameModus.getRect().getY()+" q:"+modus);
     
      ClientFrameBean clientFrameBean = new ClientFrameBean();
     
View Full Code Here

  // constructors

  public GZIPServletOutputStreamImpl(final OutputStream out)
    throws IOException
  {
    this.out = new GZIPOutputStream(out);
  }
View Full Code Here

TOP

Related Classes of java.util.zip.GZIPOutputStream

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.