Fast way to dump an array as a string in extension?
Posted: 29 Apr 2012, 13:04
Trying to find out if there is a fast way to dump a nested SFSarray as a string to a text file (in an extension).
It seems SFSArray.toString() only converts simple objects to strings, not a whole array (like actionscript does).
So I have to iterate through each array and sub array like this:
Is there no easier/more efficient way to do this via the API?
P.s. My arrays are a few hundred K of data (sometimes approaching 1 MB).
It seems SFSArray.toString() only converts simple objects to strings, not a whole array (like actionscript does).
So I have to iterate through each array and sub array like this:
Code: Select all
String finalString = "";
for(int i=0; i<mainArray.size(); i++){
subArray = (ISFSArray) mainArray.getElementAt(i);
for(int j=0; j<subArray.size(); j++){
//my toString() here is because my array contains mixed data types so I need to convert them each to strings to save them to the final string
subStr = subArray.getElementAt(j).toString();
finalString += subStr;
}
}
Is there no easier/more efficient way to do this via the API?
P.s. My arrays are a few hundred K of data (sometimes approaching 1 MB).