diff --git a/src/main/java/com/reandroid/arsc/item/ByteArray.java b/src/main/java/com/reandroid/arsc/item/ByteArray.java index 9eb530b..86c7bcf 100755 --- a/src/main/java/com/reandroid/arsc/item/ByteArray.java +++ b/src/main/java/com/reandroid/arsc/item/ByteArray.java @@ -73,6 +73,13 @@ public class ByteArray extends BlockItem { } return getBytesInternal()[index]; } + public int getByteUnsigned(int index){ + Byte b = get(index); + if(b==null){ + return 0; + } + return 0xff & b; + } public final void put(int index, byte value){ byte[] bts = getBytesInternal(); bts[index]=value; @@ -99,6 +106,9 @@ public class ByteArray extends BlockItem { bts[offset+1]= (byte) (val >>> 8 & 0xff); bts[offset]= (byte) (val & 0xff); } + public final int getShortUnsigned(int offset){ + return 0xffff & getShort(offset); + } public final short getShort(int offset){ byte[] bts = getBytesInternal(); return (short) (bts[offset] & 0xff | (bts[offset+1] & 0xff) << 8);