deimos1988
deimos1988

Reputation: 6086

BLOB to String[][]

Is there a way to directly convert a "BLOB"-array into a String[][]-array (on Android?

Thanks very much in advance!

Upvotes: 0

Views: 3152

Answers (3)

deimos1988
deimos1988

Reputation: 6086

My solution doesn't require codingBLOBs to String[][]-arrays anymore, now I am (de-)coding SoapEnvelopes to byte-arrays and vice versa using a method described here: http://androiddevblog.blogspot.com/2010/04/serializing-and-parceling-ksoap2.html

Upvotes: 0

Ryan Amos
Ryan Amos

Reputation: 5452

Try this: Converting blob array to string array:

BLOB[] blobs = getBlobs(); //fetch it somehow
String[] strings = new String[blobs.length];
for(int i = 0; i < blobs.length; i++)
    strings[i] = new String(blobs[i].getBytes(0, blobs[i].length());
return strings;

Converting blob array to string matrix:

BLOB[] blobs = getBlobs(); //fetch it somehow
String[][] strings = new String[blobs.length][];
for(int i = 0; i < blobs.length; i++)
    strings[i] = blobToStringArray(blobs[i]);
return strings;

Upvotes: 1

Rob
Rob

Reputation: 2779

From what I understand, blobs return bytes. So you want to build a byte array and then build the string from that. This is an example.

Hope it gives you a good start.

Upvotes: 1

Related Questions