Package java.util.zip

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


                bytes = message.getBytes("UTF-8");
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException("No UTF-8 support available.", e);
            }
            stream.write(bytes);
            stream.finish();
            stream.close();
            byte[] zipped = bos.toByteArray();
            bos.close();
            return zipped;
        } catch (IOException e) {
View Full Code Here


                {
                    in.close();
                }

                // Complete the GZIP file
                out.finish();
            }
            finally
            {
                out.close();
            }
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try
        {
            GZIPOutputStream gzip = new GZIPOutputStream(baos);
            gzip.write(bytes, 0, bytes.length);
            gzip.finish();
            byte[] fewerBytes = baos.toByteArray();
            gzip.close();
            baos.close();
            gzip = null;
            baos = null;
View Full Code Here

            GZIPOutputStream gzip = null;
            try {
                os = new ByteArrayOutputStream();
                gzip = new GZIPOutputStream(os);
                gzip.write(data);
                gzip.finish();
                return new ByteArrayInputStream(os.toByteArray());
            } finally {
                ObjectHelper.close(gzip, "gzip", null);
                ObjectHelper.close(os, "byte array", null);
            }
View Full Code Here

    public static byte[] compressGZIP(byte[] data) throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        GZIPOutputStream gzip = new GZIPOutputStream(os);
        try {
            gzip.write(data);
            gzip.finish();
            return os.toByteArray();
        } finally {
            gzip.close();
            os.close();
        }
View Full Code Here

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try
        {
            GZIPOutputStream gzip = new GZIPOutputStream(baos);
            gzip.write(bytes, 0, bytes.length);
            gzip.finish();
            byte[] fewerBytes = baos.toByteArray();
            gzip.close();
            baos.close();
            gzip = null;
            baos = null;
View Full Code Here

            GZIPOutputStream gzip = null;
            try {
                os = new ByteArrayOutputStream();
                gzip = new GZIPOutputStream(os);
                gzip.write(data);
                gzip.finish();
                return new ByteArrayInputStream(os.toByteArray());
            } finally {
                ObjectHelper.close(gzip, "gzip", null);
                ObjectHelper.close(os, "byte array", null);
            }
View Full Code Here

    public static byte[] compressGZIP(byte[] data) throws IOException {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        GZIPOutputStream gzip = new GZIPOutputStream(os);
        try {
            gzip.write(data);
            gzip.finish();
            return os.toByteArray();
        } finally {
            gzip.close();
            os.close();
        }
View Full Code Here

        if (rgzip)
        {
          ByteArrayOutputStream lBo = new ByteArrayOutputStream();
          GZIPOutputStream lGzo = new GZIPOutputStream(lBo);
          lGzo.write(request);
          lGzo.finish();         
          lGzo.close();         
          byte[] lArray = lBo.toByteArray();
          method.setRequestBody(new ByteArrayInputStream(lArray));
          method.setRequestContentLength(-1);
        }
View Full Code Here

    File gzFile = new File(subDir, "mail-messages.gz");
    GZIPOutputStream gzOut = null;
    try {
      gzOut = new GZIPOutputStream(new FileOutputStream(gzFile));
      gzOut.write(testMailMessages.getBytes("UTF-8"));
      gzOut.finish();
    } finally {
      Closeables.close(gzOut, false);
    }
   
    File subDir2 = new File(subDir, "subsubdir");
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.