Questions tagged [binary-data]

Binary-data is information stored using a two character alphabet (typically written using 0 and 1)

Binary Data is information which is stored using a two character alphabet. For example, the number 42 could be stored as its base-2 representation: 101010.

In modern computers, almost all data is ultimately represented in binary form.

To be useful, the writer and reader of binary data must have a pre-agreed format (e.g. a file consisting of a 32-bit, two's compliment integer followed by three IEEE 754 floating point numbers).

The term is usually used to distinguish data stored in this way against data stored using a textual encoding. For example, the digits of 42 in base-10 (4 and 2) may be represented using ASCII as 00110100 and 00110010. Whether this is considered binary data or not depends on the task at hand; a chat client would consider messages as textual data, but the communication protocol it is built on may consider the same messages as arbitrary binary data.

1585 questions
9
votes
1 answer

How to decide whether to store binary data in Postgres or in files?

I'm developing a Postgres-backed system, in which many binary files will be stored. I have at least 2 choices: Store them in Postgres. Store them as files. What criteria do I need to consider to make the best possible decision?
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
9
votes
2 answers

What's the difference between "VARCHAR BINARY" and "VARBINARY" in MySQL?

I've created the following test table: CREATE TABLE t ( a VARCHAR(32) BINARY, b VARBINARY(32) ); INSERT INTO t (a, b) VALUES ( 'test ', 'test '); INSERT INTO t (a, b) VALUES ( 'test \0', 'test \0'); But this query indicated no…
Clarence
  • 721
  • 1
  • 5
  • 9
9
votes
1 answer

What are the possible ways to encode a counter in a byte?

I am reverse engineering an AC remote control. When I send the temperature values (from 17C to 30C) I get the following stream. Temperature - Binary - Hex - Decimal 17C - 00000000 - 0x00 - 0 18C - 00010000 - 0x10 -…
scrafy
  • 204
  • 1
  • 6
9
votes
1 answer

Getting binary data directly off the windows clipboard

I've been beating my head against the desk for about an hour now just trying to find some way of getting say... an array of bytes off the clipboard. Instead, all I can seem to find is information on how to get plain text from the clipboard...…
BeigeAlert
  • 197
  • 1
  • 11
9
votes
3 answers

Is there a way to load a binary file as a const variable in C at compile time

I was wondering if there is a way to load an external binary file as a variable in C through an include or a header file or something of the like. For example, in a project I am currently working on I am working with an embedded system that has a…
balmerjd
  • 166
  • 1
  • 7
9
votes
4 answers

How to shift bits in a 2-5 byte long bytes object in python?

I am trying to extract data out of a byte object. For example: From b'\x93\x4c\x00' my integer hides from bit 8 to 21. I tried to do bytes >> 3 but that isn't possible with more than one byte. I also tried to solve this with struct but the byte…
LandoR
  • 908
  • 1
  • 5
  • 22
9
votes
2 answers

What is the difference between a Binary and a Bitstring in Erlang?

In the Erlang shell, I can do the following: A = 300. 300 <>. <<0, 0, 1, 44>> But when I try the following: B = term_to_binary({300}). <<131,104,1,98,0,0,1,44>> <> ** exception error: bad argument <> **…
quanticle
  • 4,872
  • 6
  • 32
  • 42
8
votes
1 answer

C++ read binary file and convert to hex

I'm having some problems reading a binary file and converting it's bytes to hex representation. What I've tried so far: ifstream::pos_type size; char * memblock; ifstream file (toread, ios::in|ios::binary|ios::ate); if (file.is_open()) { …
user562854
8
votes
1 answer

Download Binary Data as a File Via Javascript

I'm making an ajax call to an API that returns binary data. I'm wondering if its possible to take that binary data and display it for the client in a new window? This is what I'm doing right now. The problem is, the document opens up, but its…
Anton
  • 1,387
  • 2
  • 17
  • 30
8
votes
2 answers

Reading large files containing files in binary format and extracting those files with minimum heap allocation

Sorry for the title, it might be a bit confusing but I don't know how I could have explained it better. There are two files with .cat (catalog file) and .dat extensions. A .cat file contains the information of binary files in a .dat file. This…
Deniz İrgin
  • 597
  • 3
  • 15
8
votes
6 answers

How to check if a file is plain text?

In my program, the user can load a file with links (it's a webcrawler), but I need to verify if the file that the user chooses is plain text or something else (only plain text will be allowed). Is it possible to do this? If it's useful, I'm using…
Renato Dinhani
  • 35,057
  • 55
  • 139
  • 199
8
votes
6 answers

General question about Binary files

I am a beginner and I am having trouble in grasping binary files. When I write to a file in binary mode (in python), I just write normal text. There is nothing binary about it. I know every file on my computer is a binary file but I am having…
stirredo
  • 2,297
  • 3
  • 19
  • 23
8
votes
0 answers

Send binary input data (gzip compressed) from POST request to Spring Web Flux

I'm trying to send a bunch of gzip compressed data (basically a json, compressed using gzip) to my Spring Web Flux application. I'm currently using Postman as my web client, and sending the data via request payload (Body -> raw). Here's a glimpse of…
Aryan Venkat
  • 679
  • 1
  • 10
  • 34
8
votes
1 answer

Persisting Blob Streams with NHibernate

If I have a class declared as: public class MyPersistentClass { public int ID { get; set; } public Stream MyData {get;set; } } How can I use NHibernate's mappings to persist the MyData property to and from the database?
plaureano
  • 3,139
  • 6
  • 30
  • 29
8
votes
1 answer

Handling BLOBs in Entity Framework 4.0 in a stream-fashion

Is it possible to handle (read and write) binary data to SQL Server using Entity Framework 4.0 using streams? (i.e.: not the whole content shipped in a byte array) An example could be taken from Download and Upload images from SQL Server via ASP.Net…
Andrei Rînea
  • 20,288
  • 17
  • 117
  • 166