提交 dadfe1d7 authored 作者: Thomas Mueller's avatar Thomas Mueller

Small performance improvement.

上级 bd49396b
......@@ -1014,13 +1014,18 @@ public class Data {
*/
public void checkCapacity(int plus) {
if (pos + plus >= data.length) {
// a separate method to simplify inlining
expand(plus);
}
}
private void expand(int plus) {
byte[] d = Utils.newBytes((data.length + plus) * 2);
// must copy everything, because pos could be 0 and data may be
// still required
System.arraycopy(data, 0, d, 0, data.length);
data = d;
}
}
/**
* Fill up the buffer with empty space and an (initially empty) checksum
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论