Hello,
I am tring to convert a set of strings to a byte[] array. At first, I do something like this to convert a byte array to a string:
public String convertByte(byte[] msg) {
String str = "";
for(int i = 0; i < msg.length; i++) {
str += (msg[i] + " * ");
}
return str;
}
When I try to convert b...
I've tried rewriting this code several times, it spits out the bytes correctly, but then when trying to read the array created from the memory stream, it's empty, what am I doing wrong?
Dim bytes() As Byte = System.Text.Encoding.ASCII.GetBytes("test this shit")
Dim bytesString As String = ""
Dim i As Integer = 0
i = 0
Dim byteStream As ...
I am working on my open source project Downloadify, and up until now it simply handles returning Strings in response to ExternalInterface.call commands.
I am trying to put together a test case using JSZip and Downloadify together, the end result being that a Zip file is created dynamically in the browser, then saved to the disk using Fi...
In a C++/CLI we have a function that returns this:
array^ OutBuffer = gcnew array(BufferSize);
IronPython treats it as a byte[].
In C#, we have a funtion that returns this:
OutBuffer = new Byte[InBuffer.Length];
While a C# client treats Outbuffer as a byte[], IronPython treats it as a tuple containing multiple arrays.
How do we mak...
Hi,
We are store string values in a database using varBinary type using c# and BinaryFormatter.We convert to byte array and then we save to DataBase
public static byte[] ToBytes(stringvalue)
{
if (value == null)
return null;
byte[] inMemoryBytes;
using (MemoryStream inMemoryData = new MemoryStream())
{
new BinaryFormat...
I have a byte array representation of a Image. How to save it on disk as an image file.
I have already done this
OutputStream out = new FileOutputStream("a.jpg");
out.write(byteArray);
out.flush();
out.close();
But when I open the image by double-clicking it, it doesn't show any image.
...
Hello
I am trying to call a function in C from C# though c ++
so basically C# -> C++ - >C
In C#, I have byte[] bytes - which reads the information from the file. I am passing the byte array and the size to C++ .
In C++ I get the byte array and the size but I am not able to convert to the specific data types.
void Image::OpenMemFile(...
Hi,
I am trying to pass a byte[] containing ASCII characters to log4j, to be logged into a file using the obvious representation. When I simply pass in the byt[] it is of course treated as an object and the logs are pretty useless. When I try to convert them to strings using new String(byte[] data), the performance of my application is ...
Hey everyone,
I am trying to retrieve the ByteArray from a file selected using the FileReference class so that I can pass this to a Web Service call that I am making to Sharepoint.
Is there any way I can do this using Flash Player 9 without having to upload to a remote server first and then downloading the file to extract the ByteArray?...
Hey, if you can get a more descriptive tittle please edit it.
I'm writing a little algorithm that involves checking values in a matrix.
Let's say:
char matrix[100][100];
char *ptr = &matrix[0][0];
imagine i populate the matrix with a couple of values (5 or 6) of 1, like:
matrix[20][35]=1;
matrix[67][34]=1;
How can I know if the bi...
I've got Textbox with a string like 89 3d 2c c0 7f 00
How to store it to Byte[] (byte array) variable ?
Now I can read only one dec value :(
Value=BitConverter.GetBytes(Int32.Parse(this.textBox3.Text.ToString()));
...
Hello,
I am trying to serialize & deserialize Vector. using ByteArray
Here is my code:
public static function serializeToString(value:Object):String{
if(value==null){
throw new Error("null isn't a legal serialization candidate");
}
var bytes:ByteArray = new ByteArray();
...
Java makes me sad since it needs wrapper classes for ArrayLists. How would I go about adding a byte[] to a ArrayList<Byte[]>?
...
Is it possible to get specific bytes from a byte array in java?
I have a byte array:
byte[] abc = new byte[512];
and i want to have 3 different byte arrays from this array.
byte 0-127
byte 128-255
byte256-511.
I tried abc.read(byte[], offset,length) but it works only if I give offset as 0, for any other value it throws an ...
Hi,
I am trying to append 2 images (as byte[] ) in GoogleAppEngine Java and then ask HttpResponseServlet to display it.
However, it does not seem like the second image is being appended.
Is there anything wrong with the snippet below?
...
resp.setContentType("image/jpeg");
byte[] allimages = new byte[1000000]; //1000kB in size
int de...
I have a field of type TimeStamp in database, which is converted in byte[] in c# code, and i need to convert it to DateTime value.
So i want to convert from an array of bytes into DateTime.
Already used this code:
byte[] byteValue = someValue;
long longVar = BitConverter.ToInt64(byteValue);
DateTime dateTimeVar = DateTime.FromBinary(lo...
Hello!
This is strange to me:
when I run in Java
byte[] data = new byte[] { 50, -106, 40, -22, -94, -119, -52, 8 };
ByteBuffer bb = ByteBuffer.wrap( data );
System.out.println( bb.getLong() );
result is 3645145936617393160
when I run in C#
//unsigned values (signed&0xff)
byte[] bytes = new byte[] { 50, 150, 40, 234, 162, 137, 204,...
Hi folks :)
I`m trying to read an image from an URL (with the java package
java.net.URL) to a byte[]. "Everything" works fine, except that the content isnt being enterely read from the stream (the image is corrupt, it doesnt contain all the image data)... The byte array is being persisted in a database (BLOB). I really dont know what t...
Hello,
I have a table in the database containing "files".
I don't know their filetype.
I need to export some stuff (including these files) and be able to import them into the same application.
So I was thinking about saving the byte array as data.dat (unknown extension).
and when importing just making a byte array from that file and put...
Hi,
I'm trying to write a function that converts a string to a base64 byte array. I've tried with this approach:
public byte[] stringToBase64ByteArray(String input)
{
byte[] ret = System.Text.Encoding.Unicode.GetBytes(input);
string s = Convert.ToBase64String(input);
ret = System.Text.Encodin...