compression

Compress dynamic content to ServletOutputStream

旧时模样 提交于 2019-12-06 15:36:31
I want to compress the dynamic created content and write to ServletOutputStream directly, without saving it as a file on the server before compressing. For example, I created an Excel Workbook and a StringBuffer that includes strings with the SQL template. I don't want to save the dynamic content to .xlsx and .sql file on the server before zipping the files and writing to ServletOutputStream for downloading. Sample Code: ServletOutputStream out = response.getOutputStream(); workbook.write(byteArrayOutputStream); zipIt(byteArrayOutputStream,out); public static boolean zipIt

representation of permutation of integer in bits

℡╲_俬逩灬. 提交于 2019-12-06 15:24:31
问题 I am trying to represent the permutation of N given positive integers. E.g. represent an arbitrary permutation of the numbers 1-16 using 4 bits or less for each of the numbers. The idea is that we can represent the permutation of 16 in 8*4 + 4*3 + 2*2 + 1*1 = 49 bits instead of 64 bits. I have an example data set as follows [10 1 3 11 2 12 8 7 4 6 9 13 15 16 5 14]. I have tried the following c program to achieve this but I am not sure how to use vector in C program to store the position of

Rendering a Sequence of Images in C# to make a video

江枫思渺然 提交于 2019-12-06 14:12:38
问题 I have a sequence of jpg images that I am capturing and rendering to the screen to create a video. I am decompressing the image from a MemoryStream using a JpegBitmapDecoder and rendering it by setting the Source on an Image control. This seems to work okay, but the processor overhead is pretty high. The images are 1280x720, running at 30fps and I can just barely keep up on my computer ( Dual Core 2.8Ghz). Running at higher resolutions cause me to throw away frames. I would like to try to get

Efficient compression and representation of key value pairs to be read from 1D barcodes

◇◆丶佛笑我妖孽 提交于 2019-12-06 13:24:12
I'm currently writing an application for Windows Mobile which needs to be able to pick up key value pairs from 1D barcodes (configuration settings). The less barcodes need to be scanned, the better. Sample input: ------------------------------ | Key | Value | ------------------------------ | 12 | Söme UTF-8 Strîng | | 9 | & another string | ------------------------------ I thought of the following algorithm: 1. Concat the key value pairs and encode the values with Base64 So we would get something like 12=U8O2bWUgVVRGLTggU3Ryw65uZw==&9=JiBhbm90aGVyIHN0cmluZw== 2. Use Huffman encoding to

Compressing a Base 62(0-9a-zA-Z) encoded string

北城以北 提交于 2019-12-06 12:25:51
I need to compress a base62 (0-9a-zA-Z) encoded string with a length of 20 characters into a 15-16 character string in order to squeeze some other information in. The tricky part is the compressed output should also be base62 encoded. Can this be done? Any suggestion is greatly appreciated. Thanks! See the Pigeonhole principle - if you try to put 100 pigeons into 10 holes, some holes will have multiple pigeons. In the same way, for your problem, there will have to be occurrences of two strings compressing to the same string. In these cases, you won't know which string to decompress the

Easiest way to compress in Python and decompress with decompress C# (and vice versa)

你说的曾经没有我的故事 提交于 2019-12-06 12:21:45
问题 I have a program with a Mono-based C# client and a Python server, which communicate over a TCP/IP socket. The messages use a mostly binary format but the largest part of each message is usually embedded UTF-8 strings (in English). Each message is typically short (under 100 bytes) but some can be longer (up to 64K). A lot of data is exchanged and I'd like to reduce message sizes and bandwidth usage by compressing the data when it's transmitted. My initial research hasn't turned up anything

How to print the content of a tar.gz file with Java?

被刻印的时光 ゝ 提交于 2019-12-06 12:07:29
问题 I have to implement an application that permits printing the content of all files within a tar.gz file. For Example: if I have three files like this in a folder called testx: A.txt contains the words "God Save The queen" B.txt contains the words "Ubi maior, minor cessat" C.txt.gz is a file compressed with gzip that contain the file c.txt with the words "Hello America!!" So I compress testx, obtain the compressed tar file: testx.tar.gz. So with my Java application I would like to print in the

Extracting files from a Jar more efficently

拟墨画扇 提交于 2019-12-06 12:07:22
问题 I'm extending a utility class that bundles a set of images and .xml description files. Currently I keep all the files in a directory and load them from there. The directory looks like this: 8.png 8.xml 9.png 9.xml 10.png 10.xml ... ... 50.png 50.xml ... Here's my current constructor. It is lightning fast and does what I need it to do. (I've stripped out some of the error checking to make it easier to read): public DivineFont(String directory ) { File dir = new File(directory); //children is

Is there any java compression utility

帅比萌擦擦* 提交于 2019-12-06 12:05:24
问题 I need to (un)zip some files and after some googling I haven't found any utility for doing it. I know I can do it with built-in java.uitl.zip.* classes but isn't there any utility, that will make it easer, best like this: SomeClass.unzip("file_name.zip", "target_directory"); or SomeClass.zip("source_directory", "target_file_name.zip", recursively); I don't want to handle streams. Just file, or better just file names... 回答1: How about the Deflater/Inflater classes mentioned in the question

How to reduce the size of video in Android? [closed]

时光总嘲笑我的痴心妄想 提交于 2019-12-06 11:32:21
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . I am new to Android .I don't know how to compress the video in android . Please, suggest me the options? 回答1: You can try Intel INDE on https://software.intel.com/en-us/intel-inde and Media Pack for Android which is a part of INDE, tutorials on https://software.intel.com/en