bytearray

How to convert pixel byte array to bitmap image in windows phone 8

会有一股神秘感。 提交于 2019-12-24 14:15:21
问题 I want to draw Image in windows phone 8 using pixel byte. so I get some pixel byte via c++ library(c++/CLI). But pixel data not include bitmap Header. It is just pixel byte array. Is this possible to convert pixel data array to bitmap Image without bitmap header in windows phone? public void updateImage(byte[] byteArray, UInt32 bufferSize, int cvtWidth, int cvtHeight) { // I saw this source a lot of search. But It's not work. It makes some exeption. BitmapImage bi = new BitmapImage();

How to get integer value from byte array returned by MetaMessage.getData()?

时间秒杀一切 提交于 2019-12-24 08:38:00
问题 I need to get the tempo value from midi file. I found out, that the set_tempo command has value 0x51, so i have this piece of code: for (int i = 0; i < tracks[0].size(); i++) { MidiEvent event = tracks[0].get(i); MidiMessage message = event.getMessage(); if (message instanceof MetaMessage) { MetaMessage mm = (MetaMessage) message; if(mm.getType()==SET_TEMPO){ // now what? mm.getData(); } } } But the method getData() returns an array of bytes! How can I convert it to normal human form, a.k.a.

how to make a bit-set/byte-array conversion in c

我是研究僧i 提交于 2019-12-24 04:04:42
问题 Given an array, unsigned char q[32]="1100111..." , how can I generate a 4-bytes bit-set, unsigned char p[4] , such that, the bit of this bit-set, equals to value inside the array, e.g., the first byte p[0]= "q[0] ... q[7]"; 2nd byte p[1]="q[8] ... q[15]", etc. and also how to do it in opposite, i.e., given bit-set, generate the array? my own trial out for the first part. unsigned char p[4]={0}; for (int j=0; j<N; j++) { if (q[j] == '1') { p [j / 8] |= 1 << (7-(j % 8)); } } Is the above right?

How to implement trim for Vec<u8>?

让人想犯罪 __ 提交于 2019-12-24 03:07:46
问题 Rust provides a trim method for strings: str.trim() removing leading and trailing whitespace. I want to have a method that does the same for bytestrings. It should take a Vec<u8> and remove leading and trailing whitespace (space, 0x20 and htab, 0x09). Writing a trim_left() is easy, you can just use an iterator with skip_while() : Rust Playground fn main() { let a: &[u8] = b" fo o "; let b: Vec<u8> = a.iter().map(|x| x.clone()).skip_while(|x| x == &0x20 || x == &0x09).collect(); println!("{:?}

How to cast enum to byte array?

☆樱花仙子☆ 提交于 2019-12-24 02:33:43
问题 Is there anyway to cast enum to byte array? I am currently using Hbase and in HBase everything should be converted to byte array in order to be persisted so I need to cast an enum value to byte array :) 回答1: You could create a simple utility class to convert the enum's name to bytes: public class EnumUtils { public static byte[] toByteArray(Enum<?> e) { return e.name().getBytes(); } } This is similar to your approach, but even cleaner (and a bit more typesafe, because it is only for enums).

Replacing strings stored in a byte array that represent Word/Excel document

梦想的初衷 提交于 2019-12-24 02:14:28
问题 I'm storing Word and Excel documents inside a SQL Server database table. These documents are pulled from the database with my C# application and are put into byte[] arrays. I want to replace certain strings found in the Word/Excel documents. What is the best way to do this with the byte array available? I was looking at something like this: string fileString = System.Text.Encoding.UTF8.GetString(image.ImageObject); fileString = fileString.Replace("FROM", "TO"); byte[] newImageObject = System

Play a video without a file on disk [Java]

你。 提交于 2019-12-24 01:44:50
问题 I'm doing a project where I have AES 256bit encrypted chunks of video (Original format of chunks is MP4) When a user select start date and end date of the video which he wants to see,I have to decrypt the corresponding chunks and play them in a video player. The problem is that I can't store decrypted files on disk, but only load them into memory,say, I can only send byte arrays to the videoplayer. I would like to implement this project in java, but I don't know how to stream chunks to the

java - IBM-IEEE double-precision floating point byte conversion

别说谁变了你拦得住时间么 提交于 2019-12-24 01:37:09
问题 I need to do IBM-IEEE floating point conversions of byte arrays in Java. I was able to successfully do conversions of single-precision float bytes using http://www.thecodingforums.com/threads/c-code-for-converting-ibm-370-floating-point-to-ieee-754.438469. But I also need to convert bytes of double-precision doubles. Everywhere I look seems to only show the single-precision conversion. The closest I've gotten is the r8ibmieee function in http://spdf.sci.gsfc.nasa.gov/pub/documents/old

Android - Convert String to byte[]

守給你的承諾、 提交于 2019-12-24 01:05:10
问题 I want to convert the string of "icon" to byte array and than to convert it to Bitmap. The problem is the image in the emulator is not displaying. I suppose I'm not doing right but I know why. I would greatly appreciate your help. Thanks in advance This is my JSON Data : { "project": [ { "abbreviation": "abd", "customer": "customer1", "description": "description1", "icon": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8

Android: write PNG ByteArray to file

独自空忆成欢 提交于 2019-12-24 00:56:30
问题 I have read an image file into ByteArray, but how can I write it back. I mean save ByteArray to image file in the file system. PNG format preferred. My code from PNG file to ByteArray: ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), mUri); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] byteArray = stream.toByteArray(); I know there are some similar questions, but I didn't find the exact