Package java.util.zip

Examples of java.util.zip.GZIPOutputStream


    final File f = new File(fileName);
    f.mkdirs();
    if (f.exists())
      f.delete();

    writer = new OJSONWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(fileName))));
    writer.beginObject();
    iDatabase.getLevel1Cache().setEnable(false);
    iDatabase.getLevel2Cache().setEnable(false);
  }
View Full Code Here


        private GZIPOutputStream io;
       
        @JRubyMethod(name = "initialize", required = 1, rest = true, frame = true, visibility = Visibility.PRIVATE)
        public IRubyObject initialize2(IRubyObject[] args, Block unusedBlock) throws IOException {
            realIo = (RubyObject)args[0];
            this.io = new GZIPOutputStream(new IOOutputStream(args[0]));
           
            return this;
        }
View Full Code Here

    }

    private BytestreamCache compressStream(BytestreamCache uncompressed) throws IOException
    {
        ByteArrayOutputStream compressed = new ByteArrayOutputStream();
        OutputStream compressor = new GZIPOutputStream(compressed);

        uncompressed.writeTo(compressor);

        compressor.close();

        return new BytestreamCache(compressed);
    }
View Full Code Here

  private static void save(
    UnicodeCharacterDatabase ucd,
    String to)
      throws IOException {
    FileOutputStream fos = new FileOutputStream(to);
    GZIPOutputStream gzip = new GZIPOutputStream(fos);
    ObjectOutputStream oos = new ObjectOutputStream(gzip);
    oos.writeObject(ucd);
    oos.close();
    gzip.close();
    fos.close();   
  }
View Full Code Here

                gzipstream = output;
            } else {
                response.addHeader("Content-Encoding", "gzip");
                response.setContentLength(-1)// don't use any preset content-length as it will be wrong after gzipping
                response.setBufferSize(compressionBuffer);
                gzipstream = new GZIPOutputStream(output);
            }
        }
        gzipstream.write(b, off, len);

    }
View Full Code Here

            if (acceptEncodingHeader!=null && acceptEncodingHeader.contains("gzip")) {
                // tell the client that the content is gzipped:
                response.setHeader("Content-Encoding", "gzip");
               
                // then gzip the body
                final GZIPOutputStream gzipOut = new GZIPOutputStream(response.getOutputStream());
                gzipOut.write(p.getBytes("UTF-8"));
                gzipOut.close();
            } else {
                // otherwise plaintext
                final PrintWriter pw = response.getWriter();
                pw.print(p);
                pw.flush();
View Full Code Here

            if (config.isGzipConnectorRequestsEnabled()) {
                // tell the server that the content is gzipped:
                method.addRequestHeader("Content-Encoding", "gzip");
                // and gzip the body:
                final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                final GZIPOutputStream gzipOut = new GZIPOutputStream(baos);
                gzipOut.write(p.getBytes("UTF-8"));
                gzipOut.close();
                final byte[] gzippedEncodedJson = baos.toByteArray();
                method.setRequestEntity(new ByteArrayRequestEntity(gzippedEncodedJson, "application/json"));
                lastRequestEncoding = "gzip";
            } else {
                // otherwise plaintext:
View Full Code Here

     *
     * @param str The string to zip
     * @return The zipped string
     */
    public byte[] zip(String str) {
        GZIPOutputStream zipStream = null;
        try {
            ByteArrayOutputStream targetStream = new ByteArrayOutputStream();
            zipStream = new GZIPOutputStream(targetStream);
            zipStream.write(str.getBytes());
            zipStream.close();
            byte[] zipped = targetStream.toByteArray();
            targetStream.close();
            return zipped;
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        } finally {
            try {
                if (zipStream != null) {
                    zipStream.close();
                }
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }
View Full Code Here

  if(ras == null)
      throw new IllegalArgumentException(
      JaiI18N.getString("TileEncoder1")) ;

  ObjectOutputStream oos
      = new ObjectOutputStream(new GZIPOutputStream(outputStream)) ;
  Object object = TileCodecUtils.serializeRaster(ras);
  oos.writeObject(object);
  oos.close();
    }
View Full Code Here

            if (!targetFile.delete()) {
                throw new IOException("Could not delete " + targetFile);
            }
        }

        GZIPOutputStream outputStream = new GZIPOutputStream(new FileOutputStream(new File(target, MANIFEST_NAME)));
        try {
            resultManifest.write(outputStream);
        }
        finally {
            outputStream.close();
        }
        writeIndex(targetIndex, result);
    }
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.