bytearray

how to send an array of bytes over a TCP connection (java programming)

Can somebody demonstrate how to send an array of bytes over a TCP connection from a sender program to a receiver program in Java. byte[] myByteArray (I'm new to Java programming, and can't seem to find an example of how to do this that shows both ends of the connection (sender and receiver.) If you know of an existing example, maybe y...

Load and add code to external swf with bytearray?

Hi everybody, I would like to know if it is possible to load an external movie and add code with ByteArray inside, in order to add anymore properties, functions or why not Sprites? Regards, Stephane ...

Blob byte array in XML to Image

Hi, I am getting a XML File to generate a preview, in a format like this: <PARAM> <LABEL>Preview 16x16</LABEL> <ID>{03F5C6D3-ABCD-4889-B3AA-C3524C62FA1C}</ID> <LAYER>-1</LAYER> <VALUE> <BLOB> /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8S ...

byte array of an image in android

i have created a grid view of some images in android sdk (2.1).i need to get the byte array of the image selected and do manipulations(such as to change the LSB).can anyone help with the suggestions or code? thanks in advance ...

How can I convert a byte array into a double and back?

For converting a byte array to a double I found this: //convert 8 byte array to double int start=0;//??? int i = 0; int len = 8; int cnt = 0; byte[] tmp = new byte[len]; for (i = start; i < (start + len); i++) { tmp[cnt] = arr[i]; //System.out.println(java.lang.Byte.toString(arr[i]) + " " + i); cn...

What is C# .Net analog for Flash/Flex flash.utils.ByteArray?

What is the C# .Net analog for Flash/Flex flash.utils.ByteArray? ...

How can you generate the same MD5 Hashcode in C# and Java?

Hi, I have a function that generates a MD5 hash in C# like this: MD5 md5 = new MD5CryptoServiceProvider(); byte[] result = md5.ComputeHash(data); StringBuilder sb = new StringBuilder(); for (int i = 0; i < result.Length; i++) { sb.Append(result[i].ToString("X2")); } return sb.ToString(); In java my function looks like this: Mess...

How can i convert a string into byte[] of unsigned int 32 C#

I have a string like "0x5D, 0x50, 0x68, 0xBE, 0xC9, 0xB3, 0x84, 0xFF". I want to convert it into: byte[] key= new byte[] { 0x5D, 0x50, 0x68, 0xBE, 0xC9, 0xB3, 0x84, 0xFF}; I thought about splitting the string by , then loop on it and setvalue into another byte[] in index of i string Key = "0x5D, 0x50, 0x68, 0xBE, 0xC9, 0xB3, 0x84, 0...

How to get a bytearray from file stream in Adobe AIR?

I read limited (small - 15 - 500 mb files). I need to be able to put all file bytes into one single bytearray. So I have a function: [Bindable] public var ba:ByteArray = new ByteArray; //.... code ....// protected function fileOpenSelected(event:Event):void { currentFile = event.target...

How to write ASCII special characters in a .Net string

Suppose I want to use the ASCII special character FS(0x1C) in a .Net string, and then be able to format a byte array from that same string with the special character properly represented as a single byte, how would I do that? I can't seem to get my head around it. Thanks for any help you can give. ...

OutputStream with ByteArrayOutputStream not writing

Hey again Internet ! So i'm trying to write out an object to a ByteArray, but for some reason it's not writting anything, which i see by the fact that the return value is 0, and that by the fact that reading it results in an exception. BAoutput = new ByteArrayOutputStream(); Oout = new ObjectOutputStream(BAoutput); Oout.writeObject...

Adding Values to a Byte Array

I'm starting with the two values below: finalString = "38,05,e1,5f,aa,5f,aa,d0"; string[] holder = finalString.Split(','); I'm looping thru holder like so: foreach (string item in holder) { //concatenate 0x and add the value to a byte array } On each iteration I would like to concatenate a 0x to make it a hex value and add it to...

How do I initialize a fixed byte array?

I have the following struct: [StructLayout(LayoutKind.Sequential, Pack = 1)] struct cAuthLogonChallenge { byte cmd; byte error; fixed byte name[4]; public cAuthLogonChallenge() { cmd = 0x04; error = 0x00; name = ??? } } name is supposed to be a null-terminated ASCII string, and Visual S...

Properly trimming PCM data from a ByteArray

I have a situation where I need to trim a small amount of audio from the beginning of a recorded clip (generally somewhere between 110-150ms, it is an inconsistent amount). I'm recording in 44100 frequency and 16 bitrate. This is the code I'm using: public function get trimmedData():ByteArray { var ba:ByteArray = new ByteArray(...

What's the cleanest way to do byte-level manipulation?

I have the following C struct from the source code of a server, and many similar: // preprocessing magic: 1-byte alignment typedef struct AUTH_LOGON_CHALLENGE_C { // 4 byte header uint8 cmd; uint8 error; uint16 size; // 30 bytes uint8 gamename[4]; uint8 version1; uint8 version2; ...

SampleDataEvent.data.writeFloat() - Why call it twice?

Below is a snippet from the Adobe Live Docs SampleDataEvent class. It demonstrates how to create an audible sine wave by pushing samples into a ByteArray. The part that I am hung up on is why you need to push the same value into the writeFloat() method twice? var mySound:Sound = new Sound(); function sineWaveGenerator(event:SampleDataEv...

How to convert a String to a Hex Byte Array ?

Possible Duplicate: How do you convert Byte Array to Hexadecimal String, and vice versa, in C#? For testing my encryption algorithm I have being provided keys, plain text and their resulting cipher text. The keys and plaintext are in strings How do i convert it to a hex byte array?? Something like this : E8E9EAEBEDEEEFF0F2...

Free memory of a byte array in Java

What is the best way to release memory allocated by an array of bytes (new byte[size] in Java)? ...

GUID to ByteArray

I just wrote this code to convert a GUID into a byte array. Can anyone shoot any holes in it or suggest something better? public static byte[] getGuidAsByteArray(){ UUID uuid = UUID.randomUUID(); long longOne = uuid.getMostSignificantBits(); long longTwo = uuid.getLeastSignificantBits(); return new byte[] { (byte)(longOne ...

how to get a byte[] representation from a IP in String form in Java

Suppose I have the IP stored in a String: String ip = "192.168.2.1" and I want to get the byte array with the four ints. How can I do it? Thanks! ...