binary-data

What are some good binary data compression Java libraries?

I'm looking into compressing binary data, more specifically serialized Java objects. I think I need an implementation of one of the algorithms that are listed on this Wikipedia page. I found a couple of tutorials and blog posts but no libraries (and most code I found seemed to be ported from other languages... and I don't trust the effic...

Export of binary data (for example binary files) into a string with .NET ?

How can I convert/export binary data (for example binary files like excel- or word-documents) into a string (into text format) in .NET, so that it can be imported somewhere else (e.g. in another application, which was written in another programming language (not in .NET)). Are there universal concepts to achieve this goal ? ...

Transfer raw binary with apache commons-net FTPClient?

UPDATE: Solved I was calling FTPClient.setFileType() before I logged in, causing the FTP server to use the default mode (ASCII) no matter what I set it to. The client, on the other hand, was behaving as though the file type had been properly set. BINARY mode is now working exactly as desired, transporting the file byte-for-byte in all c...

Python search and replace in binary file

I am trying to search and replace some of the text (eg 'Smith, John') in this pdf form file (header.fdf, I presumed this is treated as binary file): '%FDF-1.2\n%\xe2\xe3\xcf\xd3\n1 0 obj\n<</FDF<</Fields[<</V(M)/T(PatientSexLabel)>><</V(24-09-1956 53)/T(PatientDateOfBirth)>><</V(Fisher)/T(PatientLastNameLabel)>><</V(CNSL)/T(PatientCons...

Create initial data sqlscripts with binary data, sqlserver 2005

Hi all, with a TFS 2008 Teambuildtype we create a ClickOnce Setup for a review version of our application. Within this Teambuildtype we create an initial database with some data to start directly with tests. Now i need to put some binary data in our sql script insert files (Wordfiles). How can i create a initial script with the binary...

MIDI Program Change event.

Please take a look at Midi Event Commands, where it's explained that some events like Program Change take only one parameter. My question is then what do you send along with this event's 2nd parameter's byte, is it 0x00? or you just entirely omit it from the event which doesn't really make sense? ...

How to get rid of padding bytes between data members of a struct

Hi colleagues I have a binary file with "messages" and I am trying to fit the bytes inside the right variable using structs. In my example I used two types of messages: Tmessage and Amessage. #include <iostream> #include <fstream> #include <stdlib.h> #include <string> #include <iomanip> using namespace std; struct Tmessage { un...

How to make perl script thinks that it's running on 64-bit machine?

How can I make a Perl script think that it is running on 64-bit machine? It needs to perform binary parsing of data that was written on a 64-bit machine, but it needs to be parsed on a 32-bit machine (via argument flag, for example). In my code I using pack/unpack with the formatting 'L!4'. ...

Storing and replaying binary network data with python

I have a Python application which sends 556 bytes of data across the network at a rate of 50 Hz. The binary data is generated using struct.pack() which returns a string, which is subsequently written to a UDP socket. As well as transmitting this data, I would like to save this data to file as space-efficiently as possible, including a ...

Read .dat file in c#.

i want to read a .dat file that have following conditions:- First name offset 21 First name format ASCIIz 15 chars + \0 Middle initials offset 37 ID offset -8 ID format/length Unsigned int (4 bytes) so help me for sorting ...

Searching Binary Data in Ruby

Using only pure ruby (or justifiably commonplace gems) is there an efficient way to search a large binary document for a specific string of bytes? Deeper context: the mpeg4 container format is a 4-byte indexed serialised data structure, without having to parse the structure fully (I can assume it is valid) I want to pull out specific ...

Sending sqlite db over network

I have an sqlite database whose data I need to transfer over the network, the server needs to modify the data, and then I need to get the db back and either update my local version or overwrite it with the new db. How should I do this? My coworker at first wanted to scrap the db and just use an .ini file, but this is going to be data tha...

reading double from binary file in c

hi, can anyone show how to correctly convert binary represented data into double value in C. for example, i have 8 unsigned char values to be converted to double value (let's name it buffer). so buffer[0]'s 0's bit is LSB, and buffer[7]'s 7's bit is MSB. thanks a lot in advance! ...

Why can't I write all the data from sys.stdin to a file in Windows?

I am trying to read binary data from sys.stdin using Python 2.7 on Windows XP. The binary data is a WAV file decoded by foobar2000. Normally, this data is sent to a command-line encoder such as lame.exe on stdin, where it is processed and written to an output file whose name is provided in the command-line arguments. I am trying to inter...

Byte frequency table for Huffman coding

I'm writing a huffman compressor and decompressor (in C++) that needs to work on arbitrary binary files. I need a bit of data structure advice. Right now, my compression process is as follows: Read the bytes of the file in binary form to a char* buffer Use an std::map to count the frequencies of each byte pattern in the file. (This is ...

Java - saving data in BLOB file

hi there, i want to save a lot of binary data files(pdf, images, office docs...) into one single "blob" file. now i'm not sure what is better, saving stuff with java Serializable and save things to disc or to use a database like sqlite to make things happen. or is there a third, maybe better way? my question is, how well do those method...

How to process large binary data in Clojure?

How does one process large binary data files in Clojure? Let's assume data/files are about 50MB - small enough to be processed in memory (but not with a naive implementation). The following code correctly removes ^M from small files but it throws OutOfMemoryError for larger files (like 6MB): (defn read-bin-file [file] (to-byte-array ...

Best way to assert compatible architecture when reading and writing a file?

I have a program that reads and writes a binary file. A file is interchangeable between executions of the program on the same platform, but a file produced on one machine may not be valid on another platform due to the sizes of types, endian-ness etc. I want a quick way to be able to assert that a given file is valid for reading on a g...

Generate binary file with given structure

I have a device witch use binary format style config, and i have to generate that files on-the-fly. File structure must consist of a number of configuration settings (1 per parameter) each of the form: Type Length Value where: Type: is a single-octet identifier which defines the parameter Length: is a single octet containing the l...

Write large 4 byte integer as an unsigned, binary

I have integers which floats between values: 4000000000-4294967000 (which is less than int max for a 4 byte unsigned int) and i want to save it to file, and then re-read value $f = fopen($fileName, 'wb'); fwrite($f, pack('I', $value)); It is important that in file, value must be exact 4 byte unsigned int, because external devices wil...