1 4 package com.tc.object.bytecode.hook.impl; 5 6 import com.tc.object.TCObject; 7 import com.tc.object.bytecode.ManagerUtil; 8 9 public class JavaLangArrayHelpers { 10 public static final String CLASS = "com/tc/object/bytecode/hook/impl/JavaLangArrayHelpers"; 11 12 15 public static void charArrayCopy(char[] src, int srcPos, char[] dest, int destPos, int length) { 16 TCObject tco = ManagerUtil.getObject(dest); 17 if (tco != null) { 18 ManagerUtil.charArrayCopy(src, srcPos, dest, destPos, length, tco); 19 } else { 20 System.arraycopy(src, srcPos, dest, destPos, length); 21 } 22 } 23 24 27 public static void javaLangStringGetBytes(int srcBegin, int srcEnd, byte dst[], int dstBegin, int count, int offset, 28 char[] value) { 29 if (srcBegin < 0) { throw new StringIndexOutOfBoundsException (srcBegin); } 30 if (srcEnd > count) { throw new StringIndexOutOfBoundsException (srcEnd); } 31 if (srcBegin > srcEnd) { throw new StringIndexOutOfBoundsException (srcEnd - srcBegin); } 32 int j = dstBegin; 33 int n = offset + srcEnd; 34 int i = offset + srcBegin; 35 char[] val = value; 36 37 TCObject tco = ManagerUtil.getObject(dst); 38 if (tco != null) { 39 while (i < n) { 40 dst[j] = (byte) val[i++]; 41 tco.byteFieldChanged(null, null, dst[j], j++); 42 } 43 } else { 44 while (i < n) { 45 dst[j++] = (byte) val[i++]; 46 } 47 } 48 } 49 50 53 public static void javaLangAbstractStringBuilderAppend(char[] value, int appendLength, int bufferLength) { 54 TCObject tco = ManagerUtil.getObject(value); 55 56 if (tco != null) { 57 int index = bufferLength - appendLength; 58 59 while (index < bufferLength) { 60 tco.charFieldChanged(null, null, value[index], index++); 61 } 62 } 63 } 64 65 } 66 | Popular Tags |