bytearray

Java: How to use byte literals greater than 0x7F.

In Java, I can't take a byte array of unsigned bytes (from something such as Wire Shark) and put this into java.... Because I will get compile errors since anything greater than 127 decimal/0x07F is treated not as a byte, but as an int.... IE: byte[] protocol = { 0x04, 0x01, 0x00, 0x50, /*error*/0xc1, /*error*/0xdb, 0x1c, /*erro...

raw sound byteArray to float Array

I'm trying to convert the byteArray of a Sound Object to an array with floats. The Sound Object plays back fine & at full length, but the float Array i get from it is cut off (but sounds correct), so i must be doing something wrong in the conversion: var s:Sound = mySound; s.play(); // plays fine var bytes:ByteArray = new ByteArray(); ...

C: Unpacking a byte

I asked the question here and now i would like to reverse this procedure I have an unsigned short that represents a bit pattern, I would like an array of bool[16] that has true or false set for the corresponding bit in the unsigned short. so far i have where binary 2 is an unsigned short, that has the bit pattern i wish to unpack. un...

How do I convert a binary file to a byte array?

Given the path of a file (e.g. "C:\MyPicture.jpg"), how do I convert a binary file into a byte array? I know I have a lot of .NET objects at my disposal, such as BinaryReader, FileStream, StreamReader, and others, but I'm not sure of the best method to take a binary file and convert it into byte[]. How might this be accomplished? ...

File (as a string of bytes) in AS3 code

I need to 'embed' a file as a string of bytes directly in AS3 code rather than calling it as an external resource. So this works fine: var testString = "537563636573733a20537472696e672072652d656e636f6465642e"; var testArray:ByteArray = new ByteArray(); var len:uint = testString.length; trace("testString LENGTH: " + len.toString()); f...

How do I convert a byte array to Base64 in Java?

Okay, I know how to do it in C#. It is simple as Convert.ToBase64String(byte[]) and Convert.FromBase64String(string) to get byte[] back. How can I do this in Java? ...

Silverlight Byte[] to its original file format

Hi, is there a way to convert byte[] to its original file format? Byte[] tempByte = new Byte[content.Length]; tempByte = Convert.FromBase64String(content); ...

Siverlight 4.0: How open a file

I want to create a program which opens my file onClick by providing its content in byte[] format in new page. Please help. ...

How to save ByteArray to HardDrive from Flash swf?

How to save ByteArray to HardDrive from Flash swf? So... I have a generated if flash ByteArray Now I want to save it to Hard Drive. How to du such thing? ...

Silverlight 4.0: How to convert byte[] to image?

public Image Base64ToImage(string base64String) { // Convert Base64 String to byte[] byte[] imageBytes = Convert.FromBase64String(base64String); MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length); // Convert byte[] to Image ms.Write(imageBytes, 0, imageBytes.Length)...

What is the character that represents a null byte after ASCIIEncoding.GetString(byte[])?

I have a byte array that may or may not have null bytes at the end of it. After converting it to a string I have a bunch of blank space at the end. I tried using Trim() to get rid of it, but it doesn't work. How can I remove all the blank space at the end of the string after converting the byte array? I am writing this is C#. ...

C# 4.0: Convert pdf to byte[] and vice versa

How to convert pdf to byte[] and vice versa? ...

Convert Byte [] to PDF

Hello All, With help of this question C# 4.0: Convert pdf to byte[] and vice versa i was able to convert byte[] to PDF. Byte array length is 25990 approx. When i try to open the PDF it says file is corrupted. What could be the reason? I tried the BinaryWriter but it creates PDF of 0 KB. It's a response from a Web Service Sample Code ...

Cannot convert CString to BYTE array

I need to convert CString to BYTE array. I don't know why, but everything that I found in internet does not work :( For example, I have CString str = _T("string"); I've been trying so 1) BYTE *pbBuffer = (BYTE*)(LPCTSTR)str; 2) BYTE *pbBuffer = new BYTE[str.GetLength()+1]; memcpy(pbBuffer, (VOID*)(LPCTSTR)StrRegID, str.GetLength(...

How to read some bytes from BYTE*

I have BYTE pointer. For example the length of this BYTE array is 10. How can I read 4 bytes from 3 position BYTE array? Now I doing it so BYTE *source = "1234567890\0"; BYTE* tmp = new BYTE[4+1](); for(int i=0; i<4; i++) { tmp[i] = source[i+3]; } ...

How to save web service response (a byte array) as a file using SOAP UI?

I am using SOAP UI 3.0.1 for testing my web service which returns a byte array. I want to save the byte array as a word file. How do I accomplish it using Groovy Script or any other way? The web service response is, 0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAA............................... ...

How can I access a byte array as shorts in Java

I have a an array of byte, size n, that really represents an array of short of size n/2. Before I write the array to a disk file I need to adjust the values by adding bias values stored in another array of short. In C++ I would just assign the address of the byte array to a pointer for a short array with a cast to short and use pointer...

Applet A* pathfinding using large byte[] arrays - heap space error

I've written a basic Java applet which works as a map viewer (like Google Maps) for a game fansite. In it, I've implemented an A* pathfinding algorithm on a 2D map with 16 different floors, "connected" on certain points. The floors are stored in PNG images which are downloaded when needed and converted to byte arrays. The node cost is ...

Flex ByteArray data field

The data provider (ArrayCollection) for my data grid consists of objects with ByteArray (int) fields. How do I make the data field display as int without transforming my data provider? ...

C: WinAPI CreateDIBitmap() from byte[] problem

I have been working on this problem for a while now. I am trying to add JPEG support to a program with libjpeg. For the most part, it is working fairly well, But for some JPEGs, they show up like the picture on the left. Original Image It may not be obvious, but the background shows up with alternating red green and blue rows. If any...