Package java.util.zip

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


        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


      try
      {
        output = new ByteArrayOutputStream(responseBytes.length);
        gzipOutputStream = new GZIPOutputStream(output);
        gzipOutputStream.write(responseBytes);
        gzipOutputStream.finish();
        gzipOutputStream.flush();
        response.getOutputHeaders().putSingle(HttpHeaderNames.CONTENT_ENCODING, "gzip");
        responseBytes = output.toByteArray();
      }
      catch (IOException e)
View Full Code Here

                    if ((in = openFileRead(file)) == null) {
                        rc = 1;
                        continue;
                    }
                    processStream(in, gzout);
                    gzout.finish();
                    float sizeDiff = ((float) gzfile.length() / (float) file.length()) * 100;
                    notice(String.format(fmt_size_diff, file, sizeDiff, gzfile));
                    file.delete();
                } finally {
                    close(gzout);
View Full Code Here

                close(in);
            }
        }
       
        if (use_stdout) {
            gzout.finish();
            // TEST need to see if this is even necessary, and if it is
            // should it be within a finally block
            gzout.close();
        }
    }
View Full Code Here

            Throwable caught = null;
            try {
                output = new ByteArrayOutputStream(reply.length);
                gzipOutputStream = new GZIPOutputStream(output);
                gzipOutputStream.write(reply);
                gzipOutputStream.finish();
                gzipOutputStream.flush();
                response.setHeader(CONTENT_ENCODING, CONTENT_ENCODING_GZIP);
                reply = output.toByteArray();
            } catch (IOException e) {
                caught = e;
View Full Code Here

      Throwable caught = null;
      try {
        output = new ByteArrayOutputStream(reply.length);
        gzipOutputStream = new GZIPOutputStream(output);
        gzipOutputStream.write(reply);
        gzipOutputStream.finish();
        gzipOutputStream.flush();
        response.setHeader(CONTENT_ENCODING, CONTENT_ENCODING_GZIP);
        reply = output.toByteArray();
      } catch (IOException e) {
        caught = e;
View Full Code Here

            repo.setBusy(true);
        }
        try {
          GZIPOutputStream zout = new GZIPOutputStream(out);
            m_stream.toXML(this, zout);
            zout.finish();
        }
        finally {
            // Ensure all busy flags are reset at all times...
            for (ObjectRepositoryImpl repo : m_set.getRepos()) {
                repo.setBusy(false);
View Full Code Here

        else {
          ByteArrayOutputStream compressedBytes = new ByteArrayOutputStream();
      GZIPOutputStream zip = new GZIPOutputStream(compressedBytes);
          byte[] bytes = m_xmlRepository.getBytes();
      zip.write(bytes, 0, bytes.length);
      zip.finish();
            return new ByteArrayInputStream(compressedBytes.toByteArray());
        }
    }

    public boolean commit(InputStream data, long fromVersion) throws IOException, IllegalArgumentException {
View Full Code Here

            transformer.transform(featureResults, output);

            //we need to "finish" here because if not,it is possible that the gzipped
            //content do not gets completely written
            if (gzipOut != null) {
                gzipOut.finish();
                gzipOut.flush();
            }
        } catch (TransformerException gmlException) {
            ServiceException serviceException = new ServiceException(results.getRequest().getHandle()
                    + " error:" + gmlException.getMessage());
View Full Code Here

    ByteArrayOutputStream stream = null;
        try {
            stream = new ByteArrayOutputStream();
            GZIPOutputStream gos = new GZIPOutputStream(stream);
            gos.write(bytes, 0, bytes.length);
            gos.finish();
            return stream.toByteArray();
        }
        catch(IOException e) {
            throw new IllegalStateException("Exception occurred attempting to encode a payload body", e);
        }
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.