byte

Convert SDP data from byte[] into Object?

I am currently sending and receiving SIP messages across a network. When I want to add SDP data to a SIP message I use the SessionDescription object in jrtp. This object is then added to the SIP message. But when I get a SIP message from the server its SDP is in a byte[] array. So I'm wondering is there anyway to convert the byte[] b...

How to write byte by byte to socket in PHP?

How to write byte by byte to socket in PHP? For example how can I do something like: socket_write($socket,$msg.14.56.255.11.7.89.152,strlen($msg)+7); The pseudo code concatenated digits are actually bytes in dec. Hope you understand me. ...

NSString (hex) to bytes

Isn't there any method in Objective-c that converts a hex string to bytes? For example @"1156FFCD3430AA22" to an unsigned char array {0x11, 0x56, 0xFF, ...}. ...

Convert arbitrary size of byte[] to BigInteger[] and then safely convert back to exactly the same byte[], any clues?

I believe conversion exactly to BigInteger[] would be optimal in my case. Anyone had done or found this written in Java and willing to share? So imagine I have arbitrary size byte[] = {0xff,0x3e,0x12,0x45,0x1d,0x11,0x2a,0x80,0x81,0x45,0x1d,0x11,0x2a,0x80,0x81} How do I convert it to array of BigInteger's and then be able to recover it b...

Ascii Bytes Array To Int32 or Double

I'm re-writing alibrary with a mandate to make it totally allocation free. The goal is to have 0 collections after the app's startup phase is done. Previously, there were a lot of calls like this: Int32 foo = Int32.Parse(ASCIIEncoding.ASCII.GetString(bytes, start, length)); Which I believe is allocating a string. I couldn't find a ...

Attempting to Convert Byte[] into Image... but is there platform issues involved

Greetings, Current, I'm attempting to develop an application that takes a Byte Array that is streamed to us from a Linux C language program across a TCPClient (stream) and reassemble it back into an image/jpg. The "sending" application was developed by a off-site developer who claims that the image reassembles back into an image withou...

Integer to byte conversion

Say I've got an integer, 13941412, that I wish to separate into bytes (the number is actually a color in the form 0x00bbggrr). How would you do that? In c, you'd cast the number to a BYTE and then shift the bits. How do you cast to byte in Python? ...

Conversion from Byte to ASCII in C

Hi All, Can anyone suggest means of converting a byte array to ASCII in C? Or converting byte array to hex and then to ASCII? [04/02][Edited]: To rephrase it, I wish to convert bytes to hex and store the converted hex values in a data structure. How should go about it? Regards, darkie ...

Using Python How can I read the bits in a byte?

I have a file where the first byte contains encoded information. In Matlab I can read the byte bit by bit with var=fread(file,8, 'ubit1') then retrieve each bit by var(1),var(2), etc. Is there any equivalent bit reader in python? ...

Saving any file to in the database, just convert it to a byte array?

Is converting a file to a byte array the best way to save ANY file format to disk or database var binary column? So if someone wants to save a .gif or .doc/.docx or .pdf file, can I just convert it to a bytearray UFT8 and save it to the db as a stream of bytes? ...

Convert image into useable byte array in C?

Does anyone know how to open an image, specifically a jpg, to a byte array in C or C++? Any form of help is appreciated. Thanks! ...

Working with bytes and binary data in Python

Four consecutive bytes in a byte string together specify some value. However, only 7 bits in each byte are used; the most significant bit is always zero and therefore its ignored (that makes 28 bits altogether). So... b"\x00\x00\x02\x01" would be 000 0000 000 0000 000 0010 000 0001. Or, for the sake of legibility, 10 000 0001. That's...

Getting a specific bit value in a byte string

There is a byte at a specific index in a byte string which represents eight flags; one flag per bit in the byte. If a flag is set, its corresponding bit is 1, otherwise its 0. For example, if I've got b'\x21' the flags would be 0001 0101 # Three flags are set at indexes 0, 2 and 4 # and the others are not set What w...

How does Bitmap.Save(Stream, ImageFormat) format the data?

I have a non transparent, colour bitmap with length 2480 and width 3507. Using Bitmap.GetPixel(int x, int y) I am able to get the colour information of each pixel in the bitmap. If I squirt the bitmap into a byte[]: MemoryStream ms = new MemoryStream(); bmp.Save(ms, ImageFormat.Bmp); ms.Position = 0; byte[] bytes = ms.ToArray(); the...

What does a b prefix before a python string means ?

In a python source code I stumbled upon I've seen a small b before a string like in: b"abcdef" I know of u prefix that means unicode and r prefix that means raw. What does the b stand for and in which kind of source code is it useful as it seems to be exactly like a plain string without any prefix ? ...

Difference between C# and java big endian bytes using miscutil

I'm using the miscutil library to communicate between and Java and C# application using a socket. I am trying to figure out the difference between the following code (this is Groovy, but the Java result is the same): import java.io.* def baos = new ByteArrayOutputStream(); def stream = new DataOutputStream(baos); stream.writeInt(5000)...

A Byte Array with all 0x00 is Equaled to 0x08?

I think I encountered something extraordinary strange in VS 2008. All the array values are 0x00, but why it is displayed 0x00000008 at the start of the variable? ...

New byte in php

I have code JAVA byte abyte1[] = new byte[k]; But php not have byte type. Its possible to convert this line to php? ...

method readUnsignedByte in PHP

how get UnsignedBytes in php? In java very easy: readUnsignedByte (Java) ...

bytes convert to float (php)

How can I convert from bytes to float in php? Like in Java int i = (byte3 & 0xff) << 24 | (byte2 & 0xff) << 16 | (byte1 & 0xff) << 8 | byte0 & 0xff; Float.intBitsToFloat(i); ...