bytearray

How is dumpbin able to read the export table when it appears at a file offset larger than the file itself?

I'm writing a little PE reader, so I run dumpbin alongside my test application to confirm that the values are being read correctly. Everything it working so far, except for the export table. The file I'm testing with is a DLL. My application reads the file in as a byte array, which gets passed to my PE reader class. The values align wit...

Comparing arbitrary bit sequences in a byte array in c

I have a couple uint8_t arrays in my c code, and I'd like to compare an arbitrary sequence bits from one with another. So for example, I have bitarray_1 and bitarray_2, and I'd like to compare bits 13 - 47 from bitarray_1 with bits 5-39 of bitarray_2. What is the most efficient way to do this? Currently it's a huge bottleneck in my pro...

Byte array output as an Image

I know it is be possible to do this: <asp:Image runat="server" ImageUrl="~/MyImageHandler.ashx?imageid=2" /> ...but I have a case where the byte array data is only available to the Page (ie, not available in the session, and cannot be referenced by an id) so I can't point the ImageUrl to a different page. Is there a way of giving an ...

Java string to bytearray back to string

I have a client and server java application that needs have encrypted text passing through each other. I am using an XOR encryption the encrypt the text that I want. The problem is that readline() doesn't accept string that has been XORed and will only if accepted if it is in bytes. So I've converted my plaintext (string) into a byte a...

Resizing Image from a decoded ByteArray

I am trying to display a bytearray as a resized image. The Image is displaying correctly, but the sizing is off. Let me explain. First I have the image data encoded so I need to decode the image data // Instantiate decoder var decoder:Base64Decoder = new Base64Decoder(); // Decode image data decoded.decode(picture.data); // Export data...

How to play MP3 sound from buffer (ByteArray/Stream) in ActionScript 3?

So.. I have a buffer with MP3 data (If I would save this buffer and call it buffer.mp3 it would play, but in this situation I should not save it to file system). I have to play it, but I can not, what shall I do? I tried the next code to play that buffrer(ByteArray\Stream) (I get MP3 data from server the method of getting data works ...

Usings SAFEARRAYs with VB.Net

I'm using the BusinessObjects SDK to interact with objects in its repository. The File Class has methods for sending/receiving (CopyTo and Overwrite) binary data to/from the File Repository Server (where files like Crystal Reports are stored), both of which have an overload that supports 'Binary data (safearray of VT_UI1)'. While I don...

Flex Alchemy: Returning a ByteArray from C function

I am using Flex's Alchemy library to generate SWC's out of C files. I have a byte array (unsigned char buffer[size]) in the c-layer that I'd like to return to the ActionScript layer as a ByteArray. Do I have to iterate through the array and explicitly call AS3_Set on each element or is there a way to just return the entire C array at onc...

Can I construct a BigInt with any byte array (Scala)?

I'm trying to represent the result of an MD5 hash in the shortest possible string. It seems a waste to just turn it into a hex string and let G through Z go to waste. One idea I have had is getting the MD5 hash of my input as an array of bytes and constructing a BigInt with it. I can then call toString(36), and get the number as a base-...

In C#, how can I know the file type from a byte[]?

Hi! I have a byte array filled from a file uploaded. But, in another part of the code, I need to know this file type uploaded from the byte[] so I can render the correct content-type to browser! Thanks!! ...

How to Convert Byte* to std::string in C++?

I have Byte *, want to convert it to std::string. Can you please tell me the safest way to do this? ...

byte array to string

Hello guys! have small problem, and would very much appreciate help :) I should convert byte array to string and get this output string: “[0, 0, 0, 0]” After that another method should take the string as input and retrieve the byte array from the first one. Im getting error that i have number.format exception, so i guess i should ma...

Search byte[] for pattern C#

_documentContent contains the whole document as html view source. patternToFind contains text to be searched in _documentContent. Code snippet below works fine if language is English. The same code however doesn't works at all when it encounters a language like Korean. Sample Document Present Tense The present tense is just as you...

Copy bytes in memory to an Array in VB.NET

Hello, unfortunately I cannot resort to C# in my current project, so I'll have to solve this without the unsafe keyword. I've got a bitmap, and I need to access the pixels and channel values directly. I'd like to go beyond Marshal.ReadByte() and Marshal.WriteByte() (and definitely beyond GetPixel and SetPixel). Is there a way to put a...

bytearray to image asp.net

I have a byte array representing a picture. I want to present the picture stored in that byte array in an aspx page. Can I do it using an image or imagemap control? If so - how? If not - what's the solution? ...

bytes vs bytearray in Python 2.6 and 3

I'm experimenting with bytes vs bytearray in Python 2.6. I don't understand the reason for some differences. A bytes iterator returns strings: for i in bytes(b"hi"): print(type(i)) Gives: <type 'str'> <type 'str'> But a bytearray iterator returns ints: for i in bytearray(b"hi"): print(type(i)) Gives: <type 'int'> <type...

Java Project Modules - use InputStream/OutputStream or .tmpFile/byte[]

Hi all, I found myself passing InputStream/OutputStream objects around my application modules. I'm wondering if it's better to - save the content to disk and pass something like a Resource between the various methods calls - use a byte[] array instead of having to deal with streams everytime. What's your approach in these situatio...

Divide byte array into 3 parts in C#.. plz be fast

i want to divide byte array into 3 parts in C#.. my array has foll values--> 0000000000 65535 f 0000000014 00000 n 0000000074 00000 n each entry is 20 bytes long.i want to store it in struct variable myStruct[i].offset , myStruct[i].genno , myStruct[i].flag where offset , genno, flag is not an array its an ulong , ulong, char typ...

Delphi, Copy string to Byte array

what i have works, but im looking if there is a faster way to copy a string into a pByteArray from sysutils PByteArray = ^TByteArray; TByteArray = array[0..32767] of Byte; assume a and s are setup correctly a: pByteArray; s: string; is there a fast way to do this, ie something like copy for i := 1 TO Length(s) - 1 do ...

Display a file from a byte[] or stream

I've got a winforms app that stores the contents of files in a database. The stored files can be of just about any type (word, excel, PDF, text, image ...) the user can select just about any type of file to load. The user can then query the database, find a file and then open it. I've got no problems extracting the byte array from the ...