compression

Is there a problem with IO.Compression?

放肆的年华 提交于 2019-12-10 18:33:54
问题 I've just started compressing file in VB.Net, using the following code. Since I'm targeting Fx 2.0, I can't use the Stream.CopyTo method. My code, however, gives extremely poor results compared to the gzip Normal compression profile in 7-zip. For example, my code compressed a 630MB outlook archive to 740MB, and 7-zip makes it 490MB. Here is the code. Is there a blatant mistake (or many?) Using Input As New IO.FileStream(SourceFile, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)

Windows Service “self hosted” WCF : compression?

独自空忆成欢 提交于 2019-12-10 18:04:53
问题 Using compression with WCF in IIS I can find documentation for, but its oriented towards using IIS features. I can find people talking about how they've written their own compression handlers, but it all looks pretty custom. Is there a best practice around compressing WCF? We're using http bindings. Edit: setting this as a wiki. 回答1: There's nothing out of the box to help you with this. You can indeed implement your own compression extensions for WCF - several folks have done it, and you

How to check whether a command can be executed?

旧街凉风 提交于 2019-12-10 17:51:43
问题 I have an script that will show some compress options to the user (gzip, zip, and bzip). Since this is meant to run on both Linux & Windows and the Zlib library won't be available I have to compress any files by using Unix commands. Of course, if the script runs on Windows it probably won't have any of the nice command line compress tools, and thus the app should not show any choices to the user. So, what I want to know is how to check whether the command line tool exists. I could just check

How to decompress an XZ file faster in Java?

时间秒杀一切 提交于 2019-12-10 16:46:49
问题 My SQLite db file of size 85MB is compressed using XZ format and its size has been reduced to 16MB. I use the following code (and a JAR provided by XZ for Java) to decompress it in Android Jelly Bean: try { FileInputStream fin = new FileInputStream(path + "myFile.xz"); BufferedInputStream in = new BufferedInputStream(fin); FileOutputStream out = new FileOutputStream(des + "myDecompressed"); XZInputStream xzIn = new XZInputStream(in); final byte[] buffer = new byte[8192]; int n = 0; while (-1

Compressing an image to meet a file size limit (Android)

做~自己de王妃 提交于 2019-12-10 16:29:10
问题 I've implemented the below code to scale an image down, with respect to the aspect ratio (by proportionally decreasing height/width with respect to one another).. This will definitely help to reduce the size of the images uploaded to my backend, but this does not take into account the resolution of the images. I want to set a hard image limit, say 800Kb, and if the image is greater than 800Kb after resizing, then compress to a point at which it is less than 800Kb. Anyone have any experience

How to use ICSharpCode.ZipLib with stream?

早过忘川 提交于 2019-12-10 16:27:07
问题 I'm very sorry for the conservative title and my question itself,but I'm lost. The samples provided with ICsharpCode.ZipLib doesn't include what I'm searching for. I want to decompress a byte[] by putting it in InflaterInputStream(ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream) I found a decompress function ,but it doesn't work. public static byte[] Decompress(byte[] Bytes) { ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream stream = new ICSharpCode

PDF compressing library/tool

怎甘沉沦 提交于 2019-12-10 16:13:28
问题 I am working on a project to reduce the size of the PDF's, compress them. I am wondering are there any good tools/library (.NET) in market that are really good. I did try few tools like Onstream Compression, but the results were not satisfactory. 回答1: Some additional (mega-)bytes can easily be squeezed out of PDFs. E.g., is a well known "PDF32000_2008.pdf" optimized enough? File size is 8,995,189 bytes. It uses object and xref streams, (nearly) no images, everything is packed tight. Or is it

Compression is not working

微笑、不失礼 提交于 2019-12-10 15:44:40
问题 I need to compress all dynamic content of my data export site. I've tried numerous ways, nothing works. Chrome shows that content is not compressed and "Content-Encoding" header is not present. Trying to do it like this as the last resort method (before writing any response): context.Response.Filter = new DeflateStream(context.Response.Filter, CompressionMode.Compress); context.Response.AppendHeader("Content-Encoding", "deflate"); Logging shows that this code is executed correctly. However,

How to compress PDF in JasperReports

∥☆過路亽.° 提交于 2019-12-10 15:29:19
问题 How do I apply the IS_COMPRESSED = true property to a Jasper PDF report? This is what I have but when I create a PDF report it is the same size as it's clone without compression enabled: File pdfFile = new File (pdfDirectory.getAbsolutePath() + File.separator + reportName + ".pdf"); File jrPrintFile = new File(jrprintFileLocation.getAbsolutePath() + File.separator + templateName + ".jrprint"); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(jrPrintFile); JRPdfExporter jrPdfExporter

Do I need/want gzip compression when using HTTPS?

白昼怎懂夜的黑 提交于 2019-12-10 15:14:34
问题 Does using HTTPS already include (transparent) content compression or should I still worry about negotiating with the browser whether to compress my Servlet output? If HTTPS already has compression, is it unconditional or does it need to be configured/negotiated/enabled? 回答1: TLS by default doesn't enable compression, though it (compression) is defined in TLS standard and can be enabled if both parties support it. So it's better to not rely on it and request it on HTTP level. 回答2: HTTPS only