当前位置: 首页>>代码示例>>C#>>正文


C# ZDeflaterOutputStream.Finish方法代码示例

本文整理汇总了C#中System.util.zlib.ZDeflaterOutputStream.Finish方法的典型用法代码示例。如果您正苦于以下问题:C# ZDeflaterOutputStream.Finish方法的具体用法?C# ZDeflaterOutputStream.Finish怎么用?C# ZDeflaterOutputStream.Finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.util.zlib.ZDeflaterOutputStream的用法示例。


在下文中一共展示了ZDeflaterOutputStream.Finish方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FlateCompress

 /**
 * Compresses the stream.
 * @param compressionLevel the compression level (0 = best speed, 9 = best compression, -1 is default)
 * @since   2.1.3
 */
 virtual public void FlateCompress(int compressionLevel) {
     if (!Document.Compress)
         return;
     // check if the flateCompress-method has already been used
     if (compressed) {
         return;
     }
     this.compressionLevel = compressionLevel;
     if (inputStream != null) {
         compressed = true;
         return;
     }
     // check if a filter already exists
     PdfObject filter = PdfReader.GetPdfObject(Get(PdfName.FILTER));
     if (filter != null) {
         if (filter.IsName()) {
             if (PdfName.FLATEDECODE.Equals(filter))
                 return;
         }
         else if (filter.IsArray()) {
             if (((PdfArray) filter).Contains(PdfName.FLATEDECODE))
                 return;
         }
         else {
             throw new PdfException(MessageLocalization.GetComposedMessage("stream.could.not.be.compressed.filter.is.not.a.name.or.array"));
         }
     }
     // compress
     MemoryStream stream = new MemoryStream();
     ZDeflaterOutputStream zip = new ZDeflaterOutputStream(stream, compressionLevel);
     if (streamBytes != null)
         streamBytes.WriteTo(zip);
     else
         zip.Write(bytes, 0, bytes.Length);
     //zip.Close();
     zip.Finish();
     // update the object
     streamBytes = stream;
     bytes = null;
     Put(PdfName.LENGTH, new PdfNumber(streamBytes.Length));
     if (filter == null) {
         Put(PdfName.FILTER, PdfName.FLATEDECODE);
     }
     else {
         PdfArray filters = new PdfArray(filter);
         filters.Add(0, PdfName.FLATEDECODE);
         Put(PdfName.FILTER, filters);
     }
     compressed = true;
 }
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:55,代码来源:PdfStream.cs

示例2: WriteIccProfile

 public void WriteIccProfile(byte[] data)
 {
     MemoryStream stream = new MemoryStream();
     stream.WriteByte((byte)'I');
     stream.WriteByte((byte)'C');
     stream.WriteByte((byte)'C');
     stream.WriteByte(0);
     stream.WriteByte(0);
     ZDeflaterOutputStream zip = new ZDeflaterOutputStream(stream, 5);
     zip.Write(data, 0, data.Length);
     zip.Finish();
     WriteChunk(iCCP, stream.ToArray());
 }
开发者ID:jomamorales,项目名称:createPDF,代码行数:13,代码来源:PngWriter.cs

示例3: WriteData

 public void WriteData(byte[] data, int stride)
 {
     MemoryStream stream = new MemoryStream();
     ZDeflaterOutputStream zip = new ZDeflaterOutputStream(stream, 5);
     for (int k = 0; k < data.Length; k += stride) {
         zip.WriteByte(0);
         zip.Write(data, k, stride);
     }
     zip.Finish();
     WriteChunk(IDAT, stream.ToArray());
 }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:11,代码来源:PngWriter.cs

示例4: WriteData

 public void WriteData(byte[] data, int stride)
 {
     MemoryStream stream = new MemoryStream();
     ZDeflaterOutputStream zip = new ZDeflaterOutputStream(stream, 5);
     int k;
     for (k = 0; k < data.Length - stride; k += stride) {
         zip.WriteByte(0);
         zip.Write(data, k, stride);
     }
     int remaining = data.Length - k;
     if (remaining > 0){
         zip.WriteByte(0);
         zip.Write(data, k, remaining);
     }
     zip.Finish();
     WriteChunk(IDAT, stream.ToArray());
 }
开发者ID:jomamorales,项目名称:createPDF,代码行数:17,代码来源:PngWriter.cs

示例5: FlateCompress

 // methods
 /**
  * Compresses the stream.
  *
  * @throws PdfException if a filter is allready defined
  */
 public void FlateCompress()
 {
     if (!Document.Compress)
         return;
     // check if the flateCompress-method has allready been
     if (compressed) {
         return;
     }
     if (inputStream != null) {
         compressed = true;
         return;
     }
     // check if a filter allready exists
     PdfObject filter = PdfReader.GetPdfObject(Get(PdfName.FILTER));
     if (filter != null) {
         if (filter.IsName()) {
             if (PdfName.FLATEDECODE.Equals(filter))
                 return;
         }
         else if (filter.IsArray()) {
             if (((PdfArray) filter).Contains(PdfName.FLATEDECODE))
                 return;
         }
         else {
             throw new PdfException("Stream could not be compressed: filter is not a name or array.");
         }
     }
     // compress
     MemoryStream stream = new MemoryStream();
     ZDeflaterOutputStream zip = new ZDeflaterOutputStream(stream);
     if (streamBytes != null)
         streamBytes.WriteTo(zip);
     else
         zip.Write(bytes, 0, bytes.Length);
     //zip.Close();
     zip.Finish();
     // update the object
     streamBytes = stream;
     bytes = null;
     Put(PdfName.LENGTH, new PdfNumber(streamBytes.Length));
     if (filter == null) {
         Put(PdfName.FILTER, PdfName.FLATEDECODE);
     }
     else {
         PdfArray filters = new PdfArray(filter);
         filters.Add(PdfName.FLATEDECODE);
         Put(PdfName.FILTER, filters);
     }
     compressed = true;
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:56,代码来源:PdfStream.cs


注:本文中的System.util.zlib.ZDeflaterOutputStream.Finish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。