# HG changeset patch
# User Jaroslav Tulach
PushbackInputStream
adds
* functionality to another input stream, namely
@@ -177,7 +179,7 @@
if (len < avail) {
avail = len;
}
- arraycopy(buf, pos, b, off, avail);
+ System.arraycopy(buf, pos, b, off, avail);
pos += avail;
off += avail;
len -= avail;
@@ -232,7 +234,7 @@
throw new IOException("Push back buffer is full");
}
pos -= len;
- arraycopy(b, off, buf, pos, len);
+ System.arraycopy(b, off, buf, pos, len);
}
/**
@@ -380,9 +382,4 @@
in = null;
buf = null;
}
- static void arraycopy(byte[] value, int srcBegin, byte[] dst, int dstBegin, int count) {
- while (count-- > 0) {
- dst[dstBegin++] = value[srcBegin++];
- }
- }
}
diff -r df92e9608039 -r 53fafe384803 emul/mini/src/main/java/java/lang/AbstractStringBuilder.java
--- a/emul/mini/src/main/java/java/lang/AbstractStringBuilder.java Wed Jan 23 22:33:45 2013 +0100
+++ b/emul/mini/src/main/java/java/lang/AbstractStringBuilder.java Wed Jan 23 22:55:28 2013 +0100
@@ -25,6 +25,8 @@
package java.lang;
+import org.apidesign.bck2brwsr.emul.lang.System;
+
/**
* A mutable sequence of characters.
*
@@ -350,7 +352,7 @@
throw new StringIndexOutOfBoundsException(srcEnd);
if (srcBegin > srcEnd)
throw new StringIndexOutOfBoundsException("srcBegin > srcEnd");
- arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
+ System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
}
/**
@@ -500,7 +502,7 @@
public AbstractStringBuilder append(char[] str) {
int len = str.length;
ensureCapacityInternal(count + len);
- arraycopy(str, 0, value, count, len);
+ System.arraycopy(str, 0, value, count, len);
count += len;
return this;
}
@@ -530,7 +532,7 @@
public AbstractStringBuilder append(char str[], int offset, int len) {
if (len > 0) // let arraycopy report AIOOBE for len < 0
ensureCapacityInternal(count + len);
- arraycopy(str, offset, value, count, len);
+ System.arraycopy(str, offset, value, count, len);
count += len;
return this;
}
@@ -683,7 +685,7 @@
throw new StringIndexOutOfBoundsException();
int len = end - start;
if (len > 0) {
- arraycopy(value, start+len, value, start, count-end);
+ System.arraycopy(value, start+len, value, start, count-end);
count -= len;
}
return this;
@@ -745,7 +747,7 @@
public AbstractStringBuilder deleteCharAt(int index) {
if ((index < 0) || (index >= count))
throw new StringIndexOutOfBoundsException(index);
- arraycopy(value, index+1, value, index, count-index-1);
+ System.arraycopy(value, index+1, value, index, count-index-1);
count--;
return this;
}
@@ -783,7 +785,7 @@
int newCount = count + len - (end - start);
ensureCapacityInternal(newCount);
- arraycopy(value, end, value, start + len, count - end);
+ System.arraycopy(value, end, value, start + len, count - end);
str.getChars(value, start);
count = newCount;
return this;
@@ -889,8 +891,8 @@
"offset " + offset + ", len " + len + ", str.length "
+ str.length);
ensureCapacityInternal(count + len);
- arraycopy(value, index, value, index + len, count - index);
- arraycopy(str, offset, value, index, len);
+ System.arraycopy(value, index, value, index + len, count - index);
+ System.arraycopy(str, offset, value, index, len);
count += len;
return this;
}
@@ -956,7 +958,7 @@
str = "null";
int len = str.length();
ensureCapacityInternal(count + len);
- arraycopy(value, offset, value, offset + len, count - offset);
+ System.arraycopy(value, offset, value, offset + len, count - offset);
str.getChars(value, offset);
count += len;
return this;
@@ -991,8 +993,8 @@
throw new StringIndexOutOfBoundsException(offset);
int len = str.length;
ensureCapacityInternal(count + len);
- arraycopy(value, offset, value, offset + len, count - offset);
- arraycopy(str, 0, value, offset, len);
+ System.arraycopy(value, offset, value, offset + len, count - offset);
+ System.arraycopy(str, 0, value, offset, len);
count += len;
return this;
}
@@ -1082,7 +1084,7 @@
+ s.length());
int len = end - start;
ensureCapacityInternal(count + len);
- arraycopy(value, dstOffset, value, dstOffset + len,
+ System.arraycopy(value, dstOffset, value, dstOffset + len,
count - dstOffset);
for (int i=start; iString
class represents character strings. All
@@ -787,7 +788,7 @@
"}"
)
void getChars(char dst[], int dstBegin) {
- AbstractStringBuilder.arraycopy(toCharArray(), offset(), dst, dstBegin, length());
+ System.arraycopy(toCharArray(), offset(), dst, dstBegin, length());
}
/**
@@ -836,7 +837,7 @@
if (srcBegin > srcEnd) {
throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
}
- AbstractStringBuilder.arraycopy(toCharArray(), offset() + srcBegin, dst, dstBegin,
+ System.arraycopy(toCharArray(), offset() + srcBegin, dst, dstBegin,
srcEnd - srcBegin);
}
@@ -2416,7 +2417,7 @@
// * is the write location in result */
//
// /* Just copy the first few lowerCase characters. */
-// arraycopy(value, offset, result, 0, firstUpper);
+// System.arraycopy(value, offset, result, 0, firstUpper);
//
// String lang = locale.getLanguage();
// boolean localeDependent =
@@ -2462,7 +2463,7 @@
// int mapLen = lowerCharArray.length;
// if (mapLen > srcCount) {
// char[] result2 = new char[result.length + mapLen - srcCount];
-// arraycopy(result, 0, result2, 0,
+// System.arraycopy(result, 0, result2, 0,
// i + resultOffset);
// result = result2;
// }
@@ -2584,7 +2585,7 @@
* is the write location in result *
/* Just copy the first few upperCase characters. *
- arraycopy(value, offset, result, 0, firstLower);
+ System.arraycopy(value, offset, result, 0, firstLower);
String lang = locale.getLanguage();
boolean localeDependent =
@@ -2627,7 +2628,7 @@
int mapLen = upperCharArray.length;
if (mapLen > srcCount) {
char[] result2 = new char[result.length + mapLen - srcCount];
- arraycopy(result, 0, result2, 0,
+ System.arraycopy(result, 0, result2, 0,
i + resultOffset);
result = result2;
}
diff -r df92e9608039 -r 53fafe384803 emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emul/mini/src/main/java/org/apidesign/bck2brwsr/emul/lang/System.java Wed Jan 23 22:55:28 2013 +0100
@@ -0,0 +1,64 @@
+/**
+ * Back 2 Browser Bytecode Translator
+ * Copyright (C) 2012 Jaroslav Tulach