StringTemplate does't seem to want to iterate over the byte array returned by the iterator, but it works if you return an object and access the byte array as an attribute

git-svn-id: https://smali.googlecode.com/svn/trunk@363 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-08-05 05:33:53 +00:00
parent 9596186473
commit 416b72fc74
2 changed files with 13 additions and 5 deletions

View File

@ -45,8 +45,8 @@ public class ArrayDataMethodItem extends InstructionFormatMethodItem<ArrayDataPs
return instruction.getElementWidth();
}
public Iterator<byte[]> getValues() {
return new Iterator<byte[]>() {
public Iterator<ByteArray> getValues() {
return new Iterator<ByteArray>() {
int position;
final Iterator<ArrayDataPseudoInstruction.ArrayElement> iterator = instruction.getElements();
@ -54,15 +54,23 @@ public class ArrayDataMethodItem extends InstructionFormatMethodItem<ArrayDataPs
return iterator.hasNext();
}
public byte[] next() {
public ByteArray next() {
ArrayDataPseudoInstruction.ArrayElement element = iterator.next();
byte[] array = new byte[element.elementWidth];
System.arraycopy(element.buffer, element.bufferIndex, array, 0, element.elementWidth);
return array;
return new ByteArray(array);
}
public void remove() {
}
};
}
public static class ByteArray
{
public final byte[] ByteArray;
public ByteArray(byte[] byteArray) {
this.ByteArray = byteArray;
}
}
}

View File

@ -262,7 +262,7 @@ Format51l(Instruction) ::=
ArrayData(Instruction) ::=
<<
.array-data <Instruction.ElementWidth>
<Instruction.Values: {<it; format="unsigned",separator=" ">}; separator="\n">
<Instruction.Values: {<it.ByteArray; format="unsigned",separator=" ">}; separator="\n">
.end array-data
>>