Package java.util.zip

Examples of java.util.zip.DeflaterOutputStream


    for (ContentEncoding encoding:encodings) {
      switch(encoding) {
        case GZIP:
          out = new GZIPOutputStream(out); break;
        case DEFLATE:
          out = new DeflaterOutputStream(out); break;
      }
    }
    return out;
  }
View Full Code Here


    public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
        // ask for a mandatory type conversion to avoid a possible NPE beforehand as we do copy from the InputStream
        InputStream is = exchange.getContext().getTypeConverter().mandatoryConvertTo(InputStream.class, graph);

        DeflaterOutputStream zipOutput = new DeflaterOutputStream(stream, new Deflater(compressionLevel));
        try {
            IOHelper.copy(is, zipOutput);
        } finally {
            IOHelper.close(is, zipOutput);
        }
View Full Code Here

  }

  public void write (Kryo kryo, Output output, Object object) {
    Deflater deflater = new Deflater(compressionLevel, noHeaders);
    OutputChunked outputChunked = new OutputChunked(output, 256);
    DeflaterOutputStream deflaterStream = new DeflaterOutputStream(outputChunked, deflater);
    Output deflaterOutput = new Output(deflaterStream, 256);
    kryo.writeObject(deflaterOutput, object, serializer);
    deflaterOutput.flush();
    try {
      deflaterStream.finish();
    } catch (IOException ex) {
      throw new KryoException(ex);
    }
    outputChunked.endChunks();
  }
View Full Code Here

      throw new NullPointerException();
    }

    this.item = item;
    this.outputStream = new ByteArrayOutputStream();
    this.deflaterOutputStream = new DeflaterOutputStream(outputStream);
    this.crc32 = new CRC32();
    this.size = 0;
  }
View Full Code Here

        {
          final ByteArrayOutputStream bos = new ByteArrayOutputStream();
          final Deflater def = new Deflater(nextEntry.getMethod());
          try
          {
            final DeflaterOutputStream dos = new DeflaterOutputStream(bos, def);
            try
            {
              IOUtils.getInstance().copyStreams(zipIn, dos);
              dos.flush();
            }
            finally
            {
              dos.close();
            }
          }
          finally
          {
            def.end();
View Full Code Here

      throw new NullPointerException();
    }
    this.item = item;
    this.outputStream = new ByteArrayOutputStream();
    this.deflater = new Deflater(RepositoryUtilities.getZipLevel(item));
    this.deflaterOutputStream = new DeflaterOutputStream(outputStream, deflater);
    this.crc32 = new CRC32();
    this.size = 0;
  }
View Full Code Here

        {
          final ByteArrayOutputStream bos = new ByteArrayOutputStream();
          final Deflater def = new Deflater(nextEntry.getMethod());
          try
          {
            final DeflaterOutputStream dos = new DeflaterOutputStream(bos, def);
            try
            {
              IOUtils.getInstance().copyStreams(zipIn, dos);
              dos.flush();
            }
            finally
            {
              dos.close();
            }
          }
          finally
          {
            def.end();
View Full Code Here

        try
        {
            final MemoryByteArrayOutputStream out =
                    new MemoryByteArrayOutputStream(INITIAL_BUFFER_SIZE, 256 * INITIAL_BUFFER_SIZE);
            final DeflaterOutputStream deflateOut = new DeflaterOutputStream(out);
            final OutputStreamWriter xmlBuffer = new OutputStreamWriter(deflateOut, "UTF-16");
            //    final StringWriter xmlBuffer = new StringWriter
            //        (OfficeDocumentReportTarget.INITIAL_BUFFER_SIZE);
            final XmlWriter contentXmlWriter = new XmlWriter(xmlBuffer, createTagDescription());
            contentXmlWriter.copyNamespaces(currentWriter);
View Full Code Here

                ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
                OutputStream os = bytesOut;
                ActiveMQConnection connection = getConnection();
                if (connection != null && connection.isUseCompression()) {
                    compressed = true;
                    os = new DeflaterOutputStream(os);
                }
                DataOutputStream dataOut = new DataOutputStream(os);
                MarshallingSupport.marshalPrimitiveMap(map, dataOut);
                dataOut.close();
                setContent(bytesOut.toByteSequence());
View Full Code Here

            ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
            OutputStream os = bytesOut;
            ActiveMQConnection connection = getConnection();
            if (connection != null && connection.isUseCompression()) {
                compressed = true;
                os = new DeflaterOutputStream(os);
            }
            DataOutputStream dataOut = new DataOutputStream(os);
            MarshallingSupport.writeUTF8(dataOut, this.text);
            dataOut.close();
            setContent(bytesOut.toByteSequence());
View Full Code Here

TOP

Related Classes of java.util.zip.DeflaterOutputStream

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.