Package java.util.zip

Examples of java.util.zip.GZIPOutputStream


    if (objectOutputFileName.length() != 0) {
      OutputStream os = new FileOutputStream(objectOutputFileName);
      // binary
      if (!(objectOutputFileName.endsWith(".xml") || (objectOutputFileName.endsWith(".koml") && KOML.isPresent()))) {
        if (objectOutputFileName.endsWith(".gz")) {
          os = new GZIPOutputStream(os);
        }
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
        objectOutputStream.writeObject(classifier);
        if (template != null) {
          objectOutputStream.writeObject(template);
View Full Code Here


      m_Log.statusMessage("Saving model to file...");
     
      try {
  OutputStream os = new FileOutputStream(sFile);
  if (sFile.getName().endsWith(".gz")) {
    os = new GZIPOutputStream(os);
  }
  ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
  objectOutputStream.writeObject(clusterer);
  if (trainHeader != null) objectOutputStream.writeObject(trainHeader);
  if (ignoredAtts != null) objectOutputStream.writeObject(ignoredAtts);
View Full Code Here

            while (it.hasNext()) {
                try {
                    file = (File) it.next();
                    File zipped = new File(file.getAbsolutePath() + ".gz");
                    GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(zipped));
                    BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
                    byte[] b = new byte[BUFFER_SIZE];
                    int len;

                    while ((len = in.read(b, 0, BUFFER_SIZE)) != -1) {
                        zip.write(b, 0, len);
                    }

                    zip.close();
                    in.close();
                    file.delete();
                } catch (Exception e) {
                    System.err.println("Error gzipping " + file);
                    System.err.println(e.toString());
View Full Code Here

    super();
    closed = false;
    this.response = response;
    this.output = response.getOutputStream();
    baos = new ByteArrayOutputStream();
    gzipstream = new GZIPOutputStream(baos);
  }
View Full Code Here

            msg.not.expiration -= time;

          // Writes a serializable object to this output stream.
          if (compressedFlows) {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            GZIPOutputStream gzipos = new GZIPOutputStream(baos);
           
            oos = new ObjectOutputStream(gzipos);
            oos.writeObject(msg.not);

            // 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());

            writeInt(baos.size());
View Full Code Here

      m_Log.statusMessage("Saving model to file...");
     
      try {
  OutputStream os = new FileOutputStream(sFile);
  if (sFile.getName().endsWith(".gz")) {
    os = new GZIPOutputStream(os);
  }
  ObjectOutputStream objectOutputStream = new ObjectOutputStream(os);
  objectOutputStream.writeObject(classifier);
  if (trainHeader != null) objectOutputStream.writeObject(trainHeader);
  objectOutputStream.flush();
View Full Code Here

        return bos.toByteArray_clear();
    }

    public static byte[] toGzipCompressedBytes(final Object obj) {
        final FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream();
        final GZIPOutputStream gos;
        try {
            gos = new GZIPOutputStream(bos);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        toStream(obj, gos);
        return bos.toByteArray_clear();
View Full Code Here

            Debug.printStackTrace( e );
          }
        }
      }
     
      GZIPOutputStream  os = new GZIPOutputStream( new FileOutputStream( getGlobalStateFile()));
     
      try{
       
        os.write( BEncoder.encode( map ));
       
        os.close();
       
      }catch( IOException e ){
       
        Debug.printStackTrace( e );
     
        try{
          os.close();
         
        }catch( IOException f ){
         
        }
      }
View Full Code Here

       
        if ( gzip_data == null ){
           
          ByteArrayOutputStream tos = new ByteArrayOutputStream(data.length);
         
          GZIPOutputStream gos = new GZIPOutputStream( tos );
         
          gos.write( data );
         
          gos.close();
         
          gzip_data = tos.toByteArray();
         
          root.put( "_gzipdata", gzip_data );
        }
View Full Code Here

     
      if ( reply_bytes.length < 512*1024 ){
       
        ByteArrayOutputStream temp = new ByteArrayOutputStream( reply_bytes.length );
       
        GZIPOutputStream gzos = new GZIPOutputStream(temp);
       
        gzos.write( reply_bytes );
       
        gzos.finish();
       
        reply_bytes = temp.toByteArray();
       
        do_gzip = false;
      }
    }
   
    reply_header +=
      "Content-Length: " + reply_bytes.length + NL +
      NL;

    // System.out.println( "writing reply:" + reply_header );

    OutputStream os = request.getOutputStream();
   
    os.write( reply_header.getBytes());

    if ( do_gzip ){
     
      GZIPOutputStream gzos = new GZIPOutputStream(os);
     
      gzos.write( reply_bytes );
     
      gzos.finish();
     
    }else{
   
      os.write( reply_bytes );
    }
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.