Package java.util.zip

Examples of java.util.zip.GZIPOutputStream.finish()


            // Be careful, the reset writes a TC_RESET byte
            oos.reset();
            // The OOS flush call the flush of this output stream.
            oos.flush();
            gzipos.finish();
            gzipos.flush();
           
            if (getLogger().isLoggable(BasicLevel.DEBUG))
              getLogger().log(BasicLevel.DEBUG, "writeNotification - size=" + baos.size());
View Full Code Here


       
        GZIPOutputStream gzos = new GZIPOutputStream(temp);
       
        gzos.write( reply_bytes );
       
        gzos.finish();
       
        reply_bytes = temp.toByteArray();
       
        do_gzip = false;
      }
View Full Code Here

     
      GZIPOutputStream gzos = new GZIPOutputStream(os);
     
      gzos.write( reply_bytes );
     
      gzos.finish();
     
    }else{
   
      os.write( reply_bytes );
    }
View Full Code Here

    public void close() throws IOException {
        if (bufferedOutput instanceof ByteArrayOutputStream) {
            ByteArrayOutputStream compressedContent = new ByteArrayOutputStream();
            GZIPOutputStream gzipstream = new GZIPOutputStream(compressedContent);
            gzipstream.write(((ByteArrayOutputStream) bufferedOutput).toByteArray());
            gzipstream.finish();
            byte[] compressedBytes = compressedContent.toByteArray();
            response.setContentLength(compressedBytes.length);
            response.addHeader("Content-Encoding", "gzip");
            output.write(compressedBytes);
        } else ((GZIPOutputStream) bufferedOutput).finish();
View Full Code Here

    public void close() throws IOException {
        if (bufferedOutput instanceof ByteArrayOutputStream) {
            ByteArrayOutputStream compressedContent = new ByteArrayOutputStream();
            GZIPOutputStream gzipstream = new GZIPOutputStream(compressedContent);
            gzipstream.write(((ByteArrayOutputStream) bufferedOutput).toByteArray());
            gzipstream.finish();
            byte[] compressedBytes = compressedContent.toByteArray();
            response.setContentLength(compressedBytes.length);
            response.addHeader("Content-Encoding", "gzip");
            output.write(compressedBytes);
        } else ((GZIPOutputStream) bufferedOutput).finish();
View Full Code Here

      try {
          GZIPOutputStream zippedStream = new GZIPOutputStream(baos);
          ObjectOutputStream objectOutputStream = new ObjectOutputStream(zippedStream);
          objectOutputStream.writeObject(buffer);
          objectOutputStream.flush();
          zippedStream.finish();
          ret = baos.toByteArray();
          objectOutputStream.close();
          if (ret.length >= uncompressedLength) {
             log.fine("The compressed size is bigger than the original. Will not compress since it does not make sense");
             return buffer;
View Full Code Here

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      byte[] ret = null;
      try {
          GZIPOutputStream zippedStream = new GZIPOutputStream(baos);
          zippedStream.write(buffer);
          zippedStream.finish();
          ret = baos.toByteArray();
          if (ret.length >= uncompressedLength) {
             log.fine("The compressed size is bigger than the original. Will not compress since it does not make sense");
             return buffer;
          }
View Full Code Here

                                    {
                                        def.setLevel( EJConstants.DEFAULT_COMPRESSION_LEVEL );
                                    }
                                };
                            adpt.write( new ObjectBean(), sOut );
                            sOut.finish();
                            sOut.close();
                        }
                        else
                        {
                            adpt.write( new ObjectBean(), bOut );
View Full Code Here

                    }
                };

            adapter.write( obj, new UncloseableOutputStream( sOut, adapter.requiresCustomEOFHandling() ) );

            sOut.finish();
            flushed = true;
        }
        else if ( !adapter.isSelfBuffered() )
        {
            OutputStream sOut = new UncloseableOutputStream(
View Full Code Here

      GZIPOutputStream gos = null;
      try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream(3000);
        gos = new GZIPOutputStream(baos);
        writeData(o, gos);
        gos.finish();
        gos.flush();

        byte[] data = baos.toByteArray();
        zippedData.put(o.getUID(), data);
      }
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.