In Java, there is no such thing as an unsigned byte.
Working with some low level code, occasionally you need to work with bytes that have unsigned values greater than 128, which causes Java to interpret them as a negative number due to the MSB being used for sign.
What's a good way to work around this? (Saying don't use Java is not an ...
I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array.
I couldn't have phrased it better than the person that posted the same question here:
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21062554.html
But to keep it original, I'll phrase it my own way: su...
I've got a byte() array returned as result of directx sound capture, but for other parts of my program I want to treat the results as single(). Is trundling down the array item by item the fastest way of doing it or is there a clever way to do it ?
The code that gets it is
CType(Me._applicationBuffer.Read(Me._nextCaptureOffset, GetTyp...
I am trying to convert an int into three bytes representing that int (big endian).
I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it.
For example:
int myInt;
// some code
byte b1, b2 , b3; // b1 is most significant, then b2 then b3.
*Note, I am aware that an int is 4 b...
Hi,
Need a refresher on bits/bytes, hex notation and how it relates to programming (C# preferred).
Looking for a good reading list (online preferably).
...
I'm having a class which I want to inspect it's fields, and report eventually how much bytes does each field take. I assume all fields are of types as Int32, byte etc.
How can I find out easily how much bytes does the field take?
I need something like:
Int32 a;
//int a_size = a.GetSizeInBytes;
// a_size should be 4
...
I'm wonder what the best way to convert a byte array (length 4) to an integer is in vb.net? I'm aware of BitConverter, but it seems like quite a waste to do a function call to do something that should be able to be done by copying 4 bytes of memory. Along the same lines, what about converting a single/double from it's binary representat...
Hi, I have this situation.
I have a real stored in a varbinary field in a sql 2005 database.
As I can't convert a varbinary to a real in sql 2005, I'm trying to do that in vb.net.
That field gets stored as a byte() array in a DataTable.
Now I would like to read that byte() into a double, or decimal variable.
But I don't have much of a ...
I want to convert a BYTE* into an gdi+ Image object.
How can I do this?
The BYTE* seems a Dib point.
I found Image has a method named Image::FromStream() which may help,
But I can not find any reference about how to convert a BYTE* into a IStream object.
How can I do this?
Thanks in advance!
Actually, it is hard to believe MS provide...
Basically I am inserting an image using the listviews inserting event, trying to resize an image from the fileupload control, and then save it in a SQL database using LINQ.
I found some code to create a new bitmap of the content in the fileupload control, but this was to store it in a file on the server, from this source, but I need to...
I need a byte buffer class in Java for single-threaded use. I should be able to insert data at the back of the buffer and read data at the front, with an amortized cost of O(1). The buffer should resize when it's full, rather than throw an exception or something.
I could write one myself, but I'd be very surprised if this didn't exist y...
Exactly that: Does a strings length equal the byte size? Does it matter on the language?
I think it is, but I just want to make sure.
Additional Info: I'm just wondering in general. My specific situation was PHP with MySQL.
As the answer is no, that's all I need know.
...
(Only programmers would know)
In Windows XP, under File Properties, Whats the actual file size?.. Size or Size-on-disk?
I'm looking for the exact size of the file, in bytes..
(1,024 bytes NOT 1,000 bytes)
Great! So blame it on the disk!, Why not call it Size Windows takes to store this file?
...
I have a long sequence of hex digits in a string, such as
000000000000484240FA063DE5D0B744ADBED63A81FAEA390000C8428640A43D5005BD44
only much longer, several kilobytes. Is there a builtin way to convert this to a bytes object in python 2.6/3?
...
I am working on a project where I need to deal at the byte level with integers. Since saving space is a primary consideration, I only need very small (and variable length ints).
Is there a way that I can turn the int '4096' into 3 bytes? or '1053' into a 2 bytes?
Obviously I cna do it manually = (byte[0] * 256) + (byte[1]), but i was...
What are the underlying transformations that are necessary to convert data in a little-endian system into network byte order? For 2 byte and 4 byte data there are well-known functions (such as htons, ntohl, etc.) to encapsulate the changes, what happens for strings of 1 byte data (if anything)?
Also, Wikipedia implies that little-endian...
I understand that a stream is a representation of a sequence of bytes. Each stream provides means for reading and writing bytes to its given backing store. But what is the point of the stream? Why isn't the backing store itself what we interact with?
For whatever reason this concept just isn't clicking for me. I've read a bunch of...
Hi..
Can't exactly find a way on how to do the following in C/C++.
Input : hexdecimal values, for example: ffffffffff...
I've tried the following code in order to read the input :
uint16_t twoBytes;
scanf("%x",&twoBytes);
Thats works fine and all, but how do I split the 2bytes in 1bytes uint8_t values (or maybe even read the first ...
What's an efficient way of splitting a String into chunks of 1024 bytes in java?
If there is more than one chunk then the header(fixed size string) needs to be repeated in all subsequent chunks.
...
Hello all,
At this point most people will be thinking "Ah ill post this..:"
byte[] dataB= System.Text.Encoding.ASCII.GetBytes(data);
However.. the problem I have is i need the exact value of the bytes with no encoding just the pure value for each byte. For example if the value of the string is (0xFF32) i want it to convert it too {25...