Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/compiler/patches/java.base/java/lang/Helper.java
41161 views
1
/*
2
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
package java.lang;
25
26
/**
27
* A helper class to get access to package-private members
28
*/
29
public class Helper {
30
@jdk.internal.vm.annotation.ForceInline
31
public static boolean StringCodingHasNegatives(byte[] ba, int off, int len) {
32
return StringCoding.hasNegatives(ba, off, len);
33
}
34
35
@jdk.internal.vm.annotation.ForceInline
36
public static byte[] compressByte(byte[] src, int srcOff, int dstSize, int dstOff, int len) {
37
byte[] dst = new byte[dstSize];
38
StringUTF16.compress(src, srcOff, dst, dstOff, len);
39
return dst;
40
}
41
42
@jdk.internal.vm.annotation.ForceInline
43
public static byte[] compressChar(char[] src, int srcOff, int dstSize, int dstOff, int len) {
44
byte[] dst = new byte[dstSize];
45
StringUTF16.compress(src, srcOff, dst, dstOff, len);
46
return dst;
47
}
48
49
@jdk.internal.vm.annotation.ForceInline
50
public static byte[] inflateByte(byte[] src, int srcOff, int dstSize, int dstOff, int len) {
51
byte[] dst = new byte[dstSize];
52
StringLatin1.inflate(src, srcOff, dst, dstOff, len);
53
return dst;
54
}
55
56
@jdk.internal.vm.annotation.ForceInline
57
public static char[] inflateChar(byte[] src, int srcOff, int dstSize, int dstOff, int len) {
58
char[] dst = new char[dstSize];
59
StringLatin1.inflate(src, srcOff, dst, dstOff, len);
60
return dst;
61
}
62
63
@jdk.internal.vm.annotation.ForceInline
64
public static byte[] toBytes(char[] value, int off, int len) {
65
return StringUTF16.toBytes(value, off, len);
66
}
67
68
@jdk.internal.vm.annotation.ForceInline
69
public static char[] getChars(byte[] value, int srcBegin, int srcEnd, int dstSize, int dstBegin) {
70
char[] dst = new char[dstSize];
71
StringUTF16.getChars(value, srcBegin, srcEnd, dst, dstBegin);
72
return dst;
73
}
74
75
public static void putCharSB(byte[] val, int index, int c) {
76
StringUTF16.putCharSB(val, index, c);
77
}
78
79
public static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
80
StringUTF16.putCharsSB(val, index, ca, off, end);
81
}
82
83
public static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
84
StringUTF16.putCharsSB(val, index, s, off, end);
85
}
86
87
public static int codePointAtSB(byte[] val, int index, int end) {
88
return StringUTF16.codePointAtSB(val, index, end);
89
}
90
91
public static int codePointBeforeSB(byte[] val, int index) {
92
return StringUTF16.codePointBeforeSB(val, index);
93
}
94
95
public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) {
96
return StringUTF16.codePointCountSB(val, beginIndex, endIndex);
97
}
98
99
public static int getChars(int i, int begin, int end, byte[] value) {
100
return StringUTF16.getChars(i, begin, end, value);
101
}
102
103
public static int getChars(long l, int begin, int end, byte[] value) {
104
return StringUTF16.getChars(l, begin, end, value);
105
}
106
107
public static boolean contentEquals(byte[] v1, byte[] v2, int len) {
108
return StringUTF16.contentEquals(v1, v2, len);
109
}
110
111
public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
112
return StringUTF16.contentEquals(value, cs, len);
113
}
114
115
public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
116
return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4);
117
}
118
119
public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) {
120
return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4, c5);
121
}
122
123
public static char charAt(byte[] value, int index) {
124
return StringUTF16.charAt(value, index);
125
}
126
127
public static void reverse(byte[] value, int count) {
128
StringUTF16.reverse(value, count);
129
}
130
131
public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
132
StringUTF16.inflate(src, srcOff, dst, dstOff, len);
133
}
134
135
public static int indexOf(byte[] src, int srcCount,
136
byte[] tgt, int tgtCount, int fromIndex) {
137
return StringUTF16.indexOf(src, srcCount, tgt, tgtCount, fromIndex);
138
}
139
140
public static int indexOfLatin1(byte[] src, int srcCount,
141
byte[] tgt, int tgtCount, int fromIndex) {
142
return StringUTF16.indexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
143
}
144
public static int lastIndexOf(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
145
int srcCount = StringUTF16.length(src); // ignored
146
return StringUTF16.lastIndexOf(src, srcCount, tgt, tgtCount, fromIndex);
147
}
148
149
public static int lastIndexOfLatin1(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
150
int srcCount = StringUTF16.length(src); // ignored
151
return StringUTF16.lastIndexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
152
}
153
154
}
155
156