public ParallelDeflateOutputStream(System.IO.Stream stream,
                                    CompressionLevel level,
                                    CompressionStrategy strategy,
                                    bool leaveOpen)
 {
     TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
     TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
     _outStream          = stream;
     _compressLevel      = level;
     Strategy            = strategy;
     _leaveOpen          = leaveOpen;
     this.MaxBufferPairs = 16; // default
 }
Exemplo n.º 2
0
        public WorkItem(int size, Ionic.Zlib.CompressionLevel compressLevel, CompressionStrategy strategy)
        {
            buffer = new byte[size];
            // alloc 5 bytes overhead for every block (margin of safety= 2)
            int n = size + ((size / 32768) + 1) * 5 * 2;

            compressed = new byte[n];

            status     = (int)Status.None;
            compressor = new ZlibCodec();
            compressor.InitializeDeflate(compressLevel, false);
            compressor.OutputBuffer = compressed;
            compressor.InputBuffer  = buffer;
        }
        /// <summary>
        /// Create a ParallelDeflateOutputStream using the specified
        /// CompressionLevel and CompressionStrategy, and specifying whether to
        /// leave the captive stream open when the ParallelDeflateOutputStream is
        /// closed.
        /// </summary>
        /// <remarks>
        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
        ///   constructor for example code.
        /// </remarks>
        /// <param name="stream">The stream to which compressed data will be written.</param>
        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
        /// <param name="strategy">
        ///   By tweaking this parameter, you may be able to optimize the compression for
        ///   data with particular characteristics.
        /// </param>
        /// <param name="leaveOpen">
        ///    true if the application would like the stream to remain open after inflation/deflation.
        /// </param>
        public ParallelGZipOutputStream(System.IO.Stream stream,
                                        CompressionLevel level,
                                        CompressionStrategy strategy,
                                        bool leaveOpen)
        {
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
            _outStream     = stream;
            _compressLevel = level;
            Strategy       = strategy;
            _leaveOpen     = leaveOpen;

            _nBuckets   = 4; // default
            _bufferSize = IO_BUFFER_SIZE_DEFAULT;
        }
        public WorkItem(int size,
                        Ionic.Zlib.CompressionLevel compressLevel,
                        CompressionStrategy strategy,
                        int ix)
        {
            this.buffer = new byte[size];
            // alloc 5 bytes overhead for every block (margin of safety= 2)
            int n = size + ((size / 32768) + 1) * 5 * 2;

            this.compressed = new byte[n];
            this.compressor = new ZlibCodec();
            this.compressor.InitializeDeflate(compressLevel, false);
            this.compressor.OutputBuffer = this.compressed;
            this.compressor.InputBuffer  = this.buffer;
            this.index = ix;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Create a ParallelDeflateOutputStream using the specified
        /// CompressionLevel and CompressionStrategy, and specifying whether to
        /// leave the captive stream open when the ParallelDeflateOutputStream is
        /// closed.
        /// </summary>
        /// <remarks>
        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
        ///   constructor for example code.
        /// </remarks>
        /// <param name="stream">The stream to which compressed data will be written.</param>
        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
        /// <param name="strategy">
        ///   By tweaking this parameter, you may be able to optimize the compression for
        ///   data with particular characteristics.
        /// </param>
        /// <param name="leaveOpen">
        ///    true if the application would like the stream to remain open after inflation/deflation.
        /// </param>
        public ParallelDeflateOutputStream(System.IO.Stream stream,
                                           CompressionLevel level,
                                           CompressionStrategy strategy,
                                           bool leaveOpen)
        {
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
            _compressLevel = level;
            _leaveOpen     = leaveOpen;
            Strategy       = strategy;

            BuffersPerCore = 4; // default

            _writingDone  = new ManualResetEvent(false);
            _sessionReset = new ManualResetEvent(false);

            _outStream = stream;
        }
Exemplo n.º 6
0
			public void SetCompression(Ionic.Zlib.CompressionLevel Level)
			{
				Zip.CompressionLevel = Level;
			}
 /// <summary>
 /// Create a ParallelDeflateOutputStream using the specified
 /// CompressionLevel and CompressionStrategy, and specifying whether to
 /// leave the captive stream open when the ParallelDeflateOutputStream is
 /// closed.
 /// </summary>
 /// <remarks>
 ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
 ///   constructor for example code.
 /// </remarks>
 /// <param name="stream">The stream to which compressed data will be written.</param>
 /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
 /// <param name="strategy">
 ///   By tweaking this parameter, you may be able to optimize the compression for
 ///   data with particular characteristics.
 /// </param>
 /// <param name="leaveOpen">
 ///    true if the application would like the stream to remain open after inflation/deflation.
 /// </param>
 public ParallelDeflateOutputStream(System.IO.Stream stream,
                                    CompressionLevel level,
                                    CompressionStrategy strategy,
                                    bool leaveOpen)
 {
     TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
     TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
     _outStream = stream;
     _compressLevel= level;
     Strategy = strategy;
     _leaveOpen = leaveOpen;
     this.MaxBufferPairs = 16; // default
 }
        /// <summary>
        /// Create a ParallelDeflateOutputStream using the specified
        /// CompressionLevel and CompressionStrategy, and specifying whether to
        /// leave the captive stream open when the ParallelDeflateOutputStream is
        /// closed.
        /// </summary>
        /// <remarks>
        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
        ///   constructor for example code.
        /// </remarks>
        /// <param name="stream">The stream to which compressed data will be written.</param>
        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
        /// <param name="strategy">
        ///   By tweaking this parameter, you may be able to optimize the compression for
        ///   data with particular characteristics.
        /// </param>
        /// <param name="leaveOpen">
        ///    true if the application would like the stream to remain open after inflation/deflation.
        /// </param>
        public ParallelGZipOutputStream(System.IO.Stream stream,
                                           CompressionLevel level,
                                           CompressionStrategy strategy,
                                           bool leaveOpen)
        {
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
            _outStream = stream;
            _compressLevel= level;
            Strategy = strategy;
            _leaveOpen = leaveOpen;

            _nBuckets = 4; // default
            _bufferSize = IO_BUFFER_SIZE_DEFAULT;
        }
        /// <summary>
        /// Create a ParallelDeflateOutputStream using the specified
        /// CompressionLevel and CompressionStrategy, and specifying whether to
        /// leave the captive stream open when the ParallelDeflateOutputStream is
        /// closed.
        /// </summary>
        /// <remarks>
        ///   See the <see cref="ParallelDeflateOutputStream(System.IO.Stream)"/>
        ///   constructor for example code.
        /// </remarks>
        /// <param name="stream">The stream to which compressed data will be written.</param>
        /// <param name="level">A tuning knob to trade speed for effectiveness.</param>
        /// <param name="strategy">
        ///   By tweaking this parameter, you may be able to optimize the compression for
        ///   data with particular characteristics.
        /// </param>
        /// <param name="leaveOpen">
        ///    true if the application would like the stream to remain open after inflation/deflation.
        /// </param>
        public ParallelDeflateOutputStream(System.IO.Stream stream,
                                           CompressionLevel level,
                                           CompressionStrategy strategy,
                                           bool leaveOpen)
        {
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "-------------------------------------------------------");
            TraceOutput(TraceBits.Lifecycle | TraceBits.Session, "Create {0:X8}", this.GetHashCode());
            _compressLevel= level;
            _leaveOpen = leaveOpen;
            Strategy = strategy;

            BuffersPerCore = 4; // default

            _writingDone = new ManualResetEvent(false);
            _sessionReset = new ManualResetEvent(false);

            _outStream = stream;
        }