bytearray

Storing byte array in MySQL Blob with VBA

Anybody have some VBA code that will store a byte array into a MySQL blob column? ...

Java and Binary data in the context of sockets

Java newbie here. Are there any helper functions to serialize data in and out of byte arrays? I am writing a Java package that implements a network protocol. So I have to write some typical variables like a version (1byte), sequence Number (long) and binary data (bytes) in a loop. How do I do this in Java? Coming from C I am thinking of ...

Inserting byte array image into Word VBA

I have an image in a byte array (read it in from a MySQL blob column) and I need to insert that into a document using VBA and MS Word. Can I create a shape and use EnhMetaFileBits to "re-hydrate" it? ...

C# - Converting uint to byte[]

So I was using BitConverter.GetBytes() to convert uint32 to byte[], but my the order in the array seems to be backwards. http://msdn.microsoft.com/en-us/library/1184xdy4.aspx (shows that it's byte[] seems to be little endian). Is there a better way handle this than just using linq to reverse the byte arrays? ...

Flex binary String to ByteArray

On the server side, I have an array of objects. Each object has 3 integer fields and 2 binary fields. I've utf encoded the binary data and json encoded the array & sent it to Flex client side. On the client side, decoding data, I've got a String representing the binary data (utf decoded). Now, how can I convert this String to ByteArray...

Adding a Byte[] to a datarow

I'm trying to write a test that returns a data-reader with one of the columns being a byte[]. I figured I can create a datatable and create a reader from that. var cboTable = new DataTable("CBOTable"); var colValue = new SqlBinary(ASCII.GetBytes("Hello This is test")); cboTable.Columns.Add("ByteArrayColumn"); cboTable.Rows.Add(colValu...

Access control for binary files with Java.

Hi All. This is the situation: We have some binary files (PDFs, PPTs, ZIPz, etc.) stored in a server different from where our application is. We need to make them available for the users in our app. But files have extremely sensitive information that can not be read by anyone else but the user that has access to them which means that w...

How to remove nulls from byte array?

For some reason, the byte array output of BeginReceive fills up with nulls and then the data. BeginReceive: AsyncResult = connectSocket.BeginReceive(RecvBuffer2, 0, RecvBuffer2.Length, SocketFlags.None, OnDataRe...

AS3: Can ByteArray return its content as a string with two bytes per unicode character?

var bytes:ByteArray = new ByteArray; bytes.writeInt(0); trace(bytes.length); // prints 4 trace(bytes.toString().length); // prints 4 When I run the above code the output suggests that every character in the string returned by toString contains one byte from the ByteArray. This is of course great if you want to display the content of t...

However convert a memory to a byte array?

Now I have a database, which one field type is an array of byte. Now I have a piece of memory, or an object. How to convert this piece of memory or even an object to a byte array and so that I can store the byte array to the database. Suppose the object is Foo foo The memory is buf (actually, don't know how to declare it...

display image from byteArray.

hello guys, before asking question let me tell you about my class hierarchy. i have a Main class with has onCreate() method. in that method i have made the MapFile class' object.and called its readFile() and readIndex() methods. in readIndex() method i call another class named MapTile where i read the images tiles from my binary file a...

Quick way to get the contents of a MemoryStream as an ASCII string

I have a JSON string in a MemoryStream. I am using the following code to get it out as an ASCII string: MemoryStream memstream = new MemoryStream(); /* Write a JSON string to memstream here */ byte[] jsonBytes = new byte[memstream.Length]; memstream.Read(jsonBytes, 0, (int)memstream.Length); string jsonString = Encoding.ASCII.GetStri...

What is the C++ analog of C# byte[]?

What is the C++ (and or visual-C++) analog of C# byte[]? ...

Flex 3.4 and FMS 3.5.1 - Problem sending ByteArray on RTMP call

Hello, I installed a FMS 3.5 on my machine and created a new application with main.asc like this : application.onAppStart = function() { /* Allow debugging */ this.allowDebug = true; } //Client is connected application.onConnect = function( client ) { //Accept the connection application.acceptConnection( client ); ...

Returning more than one image from a .NET web service

Hello people, I'm able to return an image as byte array from my .NET web service.. My question is this, what if i want to return more than a single image in one request. For example, my web method currently looks something like this: public byte[] GetImage(string filename) BUT what I'm trying to work out is how i would achieve somet...

Efficient byte[] to BitmapImage and vice versa conversion in C#.

Hi there, I need to get the BitmapImage from the byte array. Currently I'm working with MemoryStream (byte[] -> MemoryStream -> BitmapImage) but it seems to be not efficient. The same situation in the other way round - I need to get the byte array representing the BitmapFrame. Again, I'm doing that with MemoryStream. What is the most...

Problem with BitmapFrame rendering (created from byte array) in C#

Hi there, Here is the situation: I have got the array of bytes containing the bitmap header together with the bitmap data. I know the offset of data, and I need to generate BitmapFrame for later rendering. I wanted to avoid array cells copying and created a wrapper for a part of the array ( ArraySegment ). Then I render this bitmap...

How to validate length of received byte array, which is not null terminated?

Hi all, I have a C\C++ code that receives a structure over the network, from this form: struct DataStruct { int DataLen; BYTE* Data; } The code I have runs over Data in a loop of DataLen times and processes the data. ...The problem: After the code came to security experts for penetration tests, they prepared a fake application whic...

computeHash byte[] and Stream difference

Hi All, I've been having some trouble with computeHash. I'm using both computeHash(Stream) and computeHash(byte[]). For some reason, they are giving back different result. I've tried writing the byte[] into a MemStream but result was the same when using Byte[] FileStream zz = new FileStream(t.Filename, FileMode.Open, FileAccess.Read);...

Serializing a Struct

UPDATE The problem is no longer in the struct itself, but in my GetSerializerFor(Type typeOfT) method shown below Original Question I have the following struct that serializes to <Base64String><string>valuehere</string></Base64String> I want it to serialize to simply <string>valuehere</string> But I can't get it to work, I have...