author | bpb |
Fri, 15 Mar 2019 16:24:07 -0700 | |
changeset 54151 | d2f8b7b33013 |
parent 54129 | deb99f13c6cd |
permissions | -rw-r--r-- |
2 | 1 |
/* |
53855 | 2 |
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
#warn This file is preprocessed before being compiled |
|
27 |
||
28 |
package java.nio; |
|
29 |
||
53959
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
30 |
import java.util.Objects; |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
31 |
|
2 | 32 |
/** |
33 |
#if[rw] |
|
34 |
* A read/write Heap$Type$Buffer. |
|
35 |
#else[rw] |
|
36 |
* A read-only Heap$Type$Buffer. This class extends the corresponding |
|
37 |
* read/write class, overriding the mutation methods to throw a {@link |
|
38 |
* ReadOnlyBufferException} and overriding the view-buffer methods to return an |
|
39 |
* instance of this class rather than of the superclass. |
|
40 |
#end[rw] |
|
41 |
*/ |
|
42 |
||
43 |
class Heap$Type$Buffer$RW$ |
|
44 |
extends {#if[ro]?Heap}$Type$Buffer |
|
45 |
{ |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
46 |
// Cached array base offset |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
47 |
private static final long ARRAY_BASE_OFFSET = UNSAFE.arrayBaseOffset($type$[].class); |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
48 |
|
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
49 |
// Cached array base offset |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
50 |
private static final long ARRAY_INDEX_SCALE = UNSAFE.arrayIndexScale($type$[].class); |
2 | 51 |
|
52 |
// For speed these fields are actually declared in X-Buffer; |
|
53 |
// these declarations are here as documentation |
|
54 |
/* |
|
55 |
#if[rw] |
|
56 |
protected final $type$[] hb; |
|
57 |
protected final int offset; |
|
58 |
#end[rw] |
|
59 |
*/ |
|
60 |
||
61 |
Heap$Type$Buffer$RW$(int cap, int lim) { // package-private |
|
62 |
#if[rw] |
|
63 |
super(-1, 0, lim, cap, new $type$[cap], 0); |
|
64 |
/* |
|
65 |
hb = new $type$[cap]; |
|
66 |
offset = 0; |
|
67 |
*/ |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
68 |
this.address = ARRAY_BASE_OFFSET; |
2 | 69 |
#else[rw] |
70 |
super(cap, lim); |
|
71 |
this.isReadOnly = true; |
|
72 |
#end[rw] |
|
73 |
} |
|
74 |
||
75 |
Heap$Type$Buffer$RW$($type$[] buf, int off, int len) { // package-private |
|
76 |
#if[rw] |
|
77 |
super(-1, off, off + len, buf.length, buf, 0); |
|
78 |
/* |
|
79 |
hb = buf; |
|
80 |
offset = 0; |
|
81 |
*/ |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
82 |
this.address = ARRAY_BASE_OFFSET; |
2 | 83 |
#else[rw] |
84 |
super(buf, off, len); |
|
85 |
this.isReadOnly = true; |
|
86 |
#end[rw] |
|
87 |
} |
|
88 |
||
89 |
protected Heap$Type$Buffer$RW$($type$[] buf, |
|
90 |
int mark, int pos, int lim, int cap, |
|
91 |
int off) |
|
92 |
{ |
|
93 |
#if[rw] |
|
94 |
super(mark, pos, lim, cap, buf, off); |
|
95 |
/* |
|
96 |
hb = buf; |
|
97 |
offset = off; |
|
98 |
*/ |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
99 |
this.address = ARRAY_BASE_OFFSET + off * ARRAY_INDEX_SCALE; |
2 | 100 |
#else[rw] |
101 |
super(buf, mark, pos, lim, cap, off); |
|
102 |
this.isReadOnly = true; |
|
103 |
#end[rw] |
|
104 |
} |
|
105 |
||
106 |
public $Type$Buffer slice() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
107 |
int rem = this.remaining(); |
2 | 108 |
return new Heap$Type$Buffer$RW$(hb, |
109 |
-1, |
|
110 |
0, |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
111 |
rem, |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
112 |
rem, |
2 | 113 |
this.position() + offset); |
114 |
} |
|
115 |
||
53959
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
116 |
@Override |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
117 |
public $Type$Buffer slice(int index, int length) { |
54129
deb99f13c6cd
8220614: (bf) Buffer absolute slice methods should use Objects.checkFromIndexSize()
bpb
parents:
54107
diff
changeset
|
118 |
Objects.checkFromIndexSize(index, length, limit()); |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
119 |
return new Heap$Type$Buffer$RW$(hb, |
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
120 |
-1, |
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
121 |
0, |
53959
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
122 |
length, |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
123 |
length, |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
124 |
index + offset); |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
125 |
} |
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
126 |
|
2 | 127 |
public $Type$Buffer duplicate() { |
128 |
return new Heap$Type$Buffer$RW$(hb, |
|
129 |
this.markValue(), |
|
130 |
this.position(), |
|
131 |
this.limit(), |
|
132 |
this.capacity(), |
|
133 |
offset); |
|
134 |
} |
|
135 |
||
136 |
public $Type$Buffer asReadOnlyBuffer() { |
|
137 |
#if[rw] |
|
138 |
return new Heap$Type$BufferR(hb, |
|
139 |
this.markValue(), |
|
140 |
this.position(), |
|
141 |
this.limit(), |
|
142 |
this.capacity(), |
|
143 |
offset); |
|
144 |
#else[rw] |
|
145 |
return duplicate(); |
|
146 |
#end[rw] |
|
147 |
} |
|
148 |
||
149 |
#if[rw] |
|
150 |
||
151 |
protected int ix(int i) { |
|
152 |
return i + offset; |
|
153 |
} |
|
154 |
||
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
155 |
#if[byte] |
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
156 |
private long byteOffset(long i) { |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
157 |
return address + i; |
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
158 |
} |
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
159 |
#end[byte] |
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
160 |
|
2 | 161 |
public $type$ get() { |
162 |
return hb[ix(nextGetIndex())]; |
|
163 |
} |
|
164 |
||
165 |
public $type$ get(int i) { |
|
166 |
return hb[ix(checkIndex(i))]; |
|
167 |
} |
|
168 |
||
17922
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
169 |
#if[streamableType] |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
170 |
$type$ getUnchecked(int i) { |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
171 |
return hb[ix(i)]; |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
172 |
} |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
173 |
#end[streamableType] |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
174 |
|
2 | 175 |
public $Type$Buffer get($type$[] dst, int offset, int length) { |
54151
d2f8b7b33013
8219876: (bf) Improve IndexOutOfBoundsException messages in $Type$Buffer classes
bpb
parents:
54129
diff
changeset
|
176 |
Objects.checkFromIndexSize(offset, length, dst.length); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
177 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
178 |
if (length > limit() - pos) |
2 | 179 |
throw new BufferUnderflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
180 |
System.arraycopy(hb, ix(pos), dst, offset, length); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
181 |
position(pos + length); |
2 | 182 |
return this; |
183 |
} |
|
184 |
||
53855 | 185 |
public $Type$Buffer get(int index, $type$[] dst, int offset, int length) { |
186 |
Objects.checkFromIndexSize(index, length, limit()); |
|
187 |
Objects.checkFromIndexSize(offset, length, dst.length); |
|
188 |
System.arraycopy(hb, ix(index), dst, offset, length); |
|
189 |
return this; |
|
190 |
} |
|
191 |
||
2 | 192 |
public boolean isDirect() { |
193 |
return false; |
|
194 |
} |
|
195 |
||
196 |
#end[rw] |
|
197 |
||
198 |
public boolean isReadOnly() { |
|
199 |
return {#if[rw]?false:true}; |
|
200 |
} |
|
201 |
||
202 |
public $Type$Buffer put($type$ x) { |
|
203 |
#if[rw] |
|
204 |
hb[ix(nextPutIndex())] = x; |
|
205 |
return this; |
|
206 |
#else[rw] |
|
207 |
throw new ReadOnlyBufferException(); |
|
208 |
#end[rw] |
|
209 |
} |
|
210 |
||
211 |
public $Type$Buffer put(int i, $type$ x) { |
|
212 |
#if[rw] |
|
213 |
hb[ix(checkIndex(i))] = x; |
|
214 |
return this; |
|
215 |
#else[rw] |
|
216 |
throw new ReadOnlyBufferException(); |
|
217 |
#end[rw] |
|
218 |
} |
|
219 |
||
220 |
public $Type$Buffer put($type$[] src, int offset, int length) { |
|
221 |
#if[rw] |
|
54151
d2f8b7b33013
8219876: (bf) Improve IndexOutOfBoundsException messages in $Type$Buffer classes
bpb
parents:
54129
diff
changeset
|
222 |
Objects.checkFromIndexSize(offset, length, src.length); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
223 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
224 |
if (length > limit() - pos) |
2 | 225 |
throw new BufferOverflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
226 |
System.arraycopy(src, offset, hb, ix(pos), length); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
227 |
position(pos + length); |
2 | 228 |
return this; |
229 |
#else[rw] |
|
230 |
throw new ReadOnlyBufferException(); |
|
231 |
#end[rw] |
|
232 |
} |
|
233 |
||
234 |
public $Type$Buffer put($Type$Buffer src) { |
|
235 |
#if[rw] |
|
236 |
if (src instanceof Heap$Type$Buffer) { |
|
237 |
if (src == this) |
|
31873
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
30338
diff
changeset
|
238 |
throw createSameBufferException(); |
2 | 239 |
Heap$Type$Buffer sb = (Heap$Type$Buffer)src; |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
240 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
241 |
int sbpos = sb.position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
242 |
int n = sb.limit() - sbpos; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
243 |
if (n > limit() - pos) |
2 | 244 |
throw new BufferOverflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
245 |
System.arraycopy(sb.hb, sb.ix(sbpos), |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
246 |
hb, ix(pos), n); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
247 |
sb.position(sbpos + n); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
248 |
position(pos + n); |
2 | 249 |
} else if (src.isDirect()) { |
250 |
int n = src.remaining(); |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
251 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
252 |
if (n > limit() - pos) |
2 | 253 |
throw new BufferOverflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
254 |
src.get(hb, ix(pos), n); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
255 |
position(pos + n); |
2 | 256 |
} else { |
257 |
super.put(src); |
|
258 |
} |
|
259 |
return this; |
|
260 |
#else[rw] |
|
261 |
throw new ReadOnlyBufferException(); |
|
262 |
#end[rw] |
|
263 |
} |
|
264 |
||
53855 | 265 |
public $Type$Buffer put(int index, $type$[] src, int offset, int length) { |
266 |
#if[rw] |
|
267 |
Objects.checkFromIndexSize(index, length, limit()); |
|
268 |
Objects.checkFromIndexSize(offset, length, src.length); |
|
269 |
System.arraycopy(src, offset, hb, ix(index), length); |
|
270 |
return this; |
|
271 |
#else[rw] |
|
272 |
throw new ReadOnlyBufferException(); |
|
273 |
#end[rw] |
|
274 |
} |
|
275 |
||
53901
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
276 |
#if[char] |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
277 |
|
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
278 |
public $Type$Buffer put(String src, int start, int end) { |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
279 |
int length = end - start; |
54151
d2f8b7b33013
8219876: (bf) Improve IndexOutOfBoundsException messages in $Type$Buffer classes
bpb
parents:
54129
diff
changeset
|
280 |
Objects.checkFromIndexSize(start, length, src.length()); |
53901
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
281 |
if (isReadOnly()) |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
282 |
throw new ReadOnlyBufferException(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
283 |
int pos = position(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
284 |
int lim = limit(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
285 |
int rem = (pos <= lim) ? lim - pos : 0; |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
286 |
if (length > rem) |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
287 |
throw new BufferOverflowException(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
288 |
src.getChars(start, end, hb, ix(pos)); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
289 |
position(pos + length); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
290 |
return this; |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
291 |
} |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
292 |
|
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
293 |
#end[char] |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
294 |
|
2 | 295 |
public $Type$Buffer compact() { |
296 |
#if[rw] |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
297 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
298 |
int rem = limit() - pos; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
299 |
System.arraycopy(hb, ix(pos), hb, ix(0), rem); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
300 |
position(rem); |
2 | 301 |
limit(capacity()); |
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
1247
diff
changeset
|
302 |
discardMark(); |
2 | 303 |
return this; |
304 |
#else[rw] |
|
305 |
throw new ReadOnlyBufferException(); |
|
306 |
#end[rw] |
|
307 |
} |
|
308 |
||
309 |
||
310 |
||
311 |
#if[byte] |
|
312 |
||
313 |
byte _get(int i) { // package-private |
|
314 |
return hb[i]; |
|
315 |
} |
|
316 |
||
317 |
void _put(int i, byte b) { // package-private |
|
318 |
#if[rw] |
|
319 |
hb[i] = b; |
|
320 |
#else[rw] |
|
321 |
throw new ReadOnlyBufferException(); |
|
322 |
#end[rw] |
|
323 |
} |
|
324 |
||
325 |
// char |
|
326 |
||
327 |
#if[rw] |
|
328 |
||
329 |
public char getChar() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
330 |
return UNSAFE.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian); |
2 | 331 |
} |
332 |
||
333 |
public char getChar(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
334 |
return UNSAFE.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian); |
2 | 335 |
} |
336 |
||
337 |
#end[rw] |
|
338 |
||
339 |
public $Type$Buffer putChar(char x) { |
|
340 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
341 |
UNSAFE.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian); |
2 | 342 |
return this; |
343 |
#else[rw] |
|
344 |
throw new ReadOnlyBufferException(); |
|
345 |
#end[rw] |
|
346 |
} |
|
347 |
||
348 |
public $Type$Buffer putChar(int i, char x) { |
|
349 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
350 |
UNSAFE.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian); |
2 | 351 |
return this; |
352 |
#else[rw] |
|
353 |
throw new ReadOnlyBufferException(); |
|
354 |
#end[rw] |
|
355 |
} |
|
356 |
||
357 |
public CharBuffer asCharBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
358 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
359 |
int size = (limit() - pos) >> 1; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
360 |
long addr = address + pos; |
2 | 361 |
return (bigEndian |
362 |
? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this, |
|
363 |
-1, |
|
364 |
0, |
|
365 |
size, |
|
366 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
367 |
addr)) |
2 | 368 |
: (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this, |
369 |
-1, |
|
370 |
0, |
|
371 |
size, |
|
372 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
373 |
addr))); |
2 | 374 |
} |
375 |
||
376 |
||
377 |
// short |
|
378 |
||
379 |
#if[rw] |
|
380 |
||
381 |
public short getShort() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
382 |
return UNSAFE.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian); |
2 | 383 |
} |
384 |
||
385 |
public short getShort(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
386 |
return UNSAFE.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian); |
2 | 387 |
} |
388 |
||
389 |
#end[rw] |
|
390 |
||
391 |
public $Type$Buffer putShort(short x) { |
|
392 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
393 |
UNSAFE.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian); |
2 | 394 |
return this; |
395 |
#else[rw] |
|
396 |
throw new ReadOnlyBufferException(); |
|
397 |
#end[rw] |
|
398 |
} |
|
399 |
||
400 |
public $Type$Buffer putShort(int i, short x) { |
|
401 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
402 |
UNSAFE.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian); |
2 | 403 |
return this; |
404 |
#else[rw] |
|
405 |
throw new ReadOnlyBufferException(); |
|
406 |
#end[rw] |
|
407 |
} |
|
408 |
||
409 |
public ShortBuffer asShortBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
410 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
411 |
int size = (limit() - pos) >> 1; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
412 |
long addr = address + pos; |
2 | 413 |
return (bigEndian |
414 |
? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this, |
|
415 |
-1, |
|
416 |
0, |
|
417 |
size, |
|
418 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
419 |
addr)) |
2 | 420 |
: (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this, |
421 |
-1, |
|
422 |
0, |
|
423 |
size, |
|
424 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
425 |
addr))); |
2 | 426 |
} |
427 |
||
428 |
||
429 |
// int |
|
430 |
||
431 |
#if[rw] |
|
432 |
||
433 |
public int getInt() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
434 |
return UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian); |
2 | 435 |
} |
436 |
||
437 |
public int getInt(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
438 |
return UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); |
2 | 439 |
} |
440 |
||
441 |
#end[rw] |
|
442 |
||
443 |
public $Type$Buffer putInt(int x) { |
|
444 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
445 |
UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian); |
2 | 446 |
return this; |
447 |
#else[rw] |
|
448 |
throw new ReadOnlyBufferException(); |
|
449 |
#end[rw] |
|
450 |
} |
|
451 |
||
452 |
public $Type$Buffer putInt(int i, int x) { |
|
453 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
454 |
UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian); |
2 | 455 |
return this; |
456 |
#else[rw] |
|
457 |
throw new ReadOnlyBufferException(); |
|
458 |
#end[rw] |
|
459 |
} |
|
460 |
||
461 |
public IntBuffer asIntBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
462 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
463 |
int size = (limit() - pos) >> 2; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
464 |
long addr = address + pos; |
2 | 465 |
return (bigEndian |
466 |
? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this, |
|
467 |
-1, |
|
468 |
0, |
|
469 |
size, |
|
470 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
471 |
addr)) |
2 | 472 |
: (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this, |
473 |
-1, |
|
474 |
0, |
|
475 |
size, |
|
476 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
477 |
addr))); |
2 | 478 |
} |
479 |
||
480 |
||
481 |
// long |
|
482 |
||
483 |
#if[rw] |
|
484 |
||
485 |
public long getLong() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
486 |
return UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian); |
2 | 487 |
} |
488 |
||
489 |
public long getLong(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
490 |
return UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian); |
2 | 491 |
} |
492 |
||
493 |
#end[rw] |
|
494 |
||
495 |
public $Type$Buffer putLong(long x) { |
|
496 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
497 |
UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian); |
2 | 498 |
return this; |
499 |
#else[rw] |
|
500 |
throw new ReadOnlyBufferException(); |
|
501 |
#end[rw] |
|
502 |
} |
|
503 |
||
504 |
public $Type$Buffer putLong(int i, long x) { |
|
505 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
506 |
UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian); |
2 | 507 |
return this; |
508 |
#else[rw] |
|
509 |
throw new ReadOnlyBufferException(); |
|
510 |
#end[rw] |
|
511 |
} |
|
512 |
||
513 |
public LongBuffer asLongBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
514 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
515 |
int size = (limit() - pos) >> 3; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
516 |
long addr = address + pos; |
2 | 517 |
return (bigEndian |
518 |
? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this, |
|
519 |
-1, |
|
520 |
0, |
|
521 |
size, |
|
522 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
523 |
addr)) |
2 | 524 |
: (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this, |
525 |
-1, |
|
526 |
0, |
|
527 |
size, |
|
528 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
529 |
addr))); |
2 | 530 |
} |
531 |
||
532 |
||
533 |
// float |
|
534 |
||
535 |
#if[rw] |
|
536 |
||
537 |
public float getFloat() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
538 |
int x = UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian); |
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
539 |
return Float.intBitsToFloat(x); |
2 | 540 |
} |
541 |
||
542 |
public float getFloat(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
543 |
int x = UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); |
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
544 |
return Float.intBitsToFloat(x); |
2 | 545 |
} |
546 |
||
547 |
#end[rw] |
|
548 |
||
549 |
public $Type$Buffer putFloat(float x) { |
|
550 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
551 |
int y = Float.floatToRawIntBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
552 |
UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian); |
2 | 553 |
return this; |
554 |
#else[rw] |
|
555 |
throw new ReadOnlyBufferException(); |
|
556 |
#end[rw] |
|
557 |
} |
|
558 |
||
559 |
public $Type$Buffer putFloat(int i, float x) { |
|
560 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
561 |
int y = Float.floatToRawIntBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
562 |
UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian); |
2 | 563 |
return this; |
564 |
#else[rw] |
|
565 |
throw new ReadOnlyBufferException(); |
|
566 |
#end[rw] |
|
567 |
} |
|
568 |
||
569 |
public FloatBuffer asFloatBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
570 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
571 |
int size = (limit() - pos) >> 2; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
572 |
long addr = address + pos; |
2 | 573 |
return (bigEndian |
574 |
? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this, |
|
575 |
-1, |
|
576 |
0, |
|
577 |
size, |
|
578 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
579 |
addr)) |
2 | 580 |
: (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this, |
581 |
-1, |
|
582 |
0, |
|
583 |
size, |
|
584 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
585 |
addr))); |
2 | 586 |
} |
587 |
||
588 |
||
589 |
// double |
|
590 |
||
591 |
#if[rw] |
|
592 |
||
593 |
public double getDouble() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
594 |
long x = UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian); |
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
595 |
return Double.longBitsToDouble(x); |
2 | 596 |
} |
597 |
||
598 |
public double getDouble(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
599 |
long x = UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian); |
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
600 |
return Double.longBitsToDouble(x); |
2 | 601 |
} |
602 |
||
603 |
#end[rw] |
|
604 |
||
605 |
public $Type$Buffer putDouble(double x) { |
|
606 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
607 |
long y = Double.doubleToRawLongBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
608 |
UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian); |
2 | 609 |
return this; |
610 |
#else[rw] |
|
611 |
throw new ReadOnlyBufferException(); |
|
612 |
#end[rw] |
|
613 |
} |
|
614 |
||
615 |
public $Type$Buffer putDouble(int i, double x) { |
|
616 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
617 |
long y = Double.doubleToRawLongBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
618 |
UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian); |
2 | 619 |
return this; |
620 |
#else[rw] |
|
621 |
throw new ReadOnlyBufferException(); |
|
622 |
#end[rw] |
|
623 |
} |
|
624 |
||
625 |
public DoubleBuffer asDoubleBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
626 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
627 |
int size = (limit() - pos) >> 3; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
628 |
long addr = address + pos; |
2 | 629 |
return (bigEndian |
630 |
? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this, |
|
631 |
-1, |
|
632 |
0, |
|
633 |
size, |
|
634 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
635 |
addr)) |
2 | 636 |
: (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this, |
637 |
-1, |
|
638 |
0, |
|
639 |
size, |
|
640 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
641 |
addr))); |
2 | 642 |
} |
643 |
||
644 |
||
645 |
#end[byte] |
|
646 |
||
647 |
||
648 |
#if[char] |
|
649 |
||
650 |
String toString(int start, int end) { // package-private |
|
651 |
try { |
|
652 |
return new String(hb, start + offset, end - start); |
|
653 |
} catch (StringIndexOutOfBoundsException x) { |
|
654 |
throw new IndexOutOfBoundsException(); |
|
655 |
} |
|
656 |
} |
|
657 |
||
658 |
||
659 |
// --- Methods to support CharSequence --- |
|
660 |
||
1224
8c1bc7c5dd00
6733145: (bf) CharBuffer.subSequence can be updated to take advantage of covariant returns
martin
parents:
2
diff
changeset
|
661 |
public CharBuffer subSequence(int start, int end) { |
2593
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
662 |
int pos = position(); |
54151
d2f8b7b33013
8219876: (bf) Improve IndexOutOfBoundsException messages in $Type$Buffer classes
bpb
parents:
54129
diff
changeset
|
663 |
Objects.checkFromToIndex(start, end, limit() - pos); |
2 | 664 |
return new HeapCharBuffer$RW$(hb, |
2593
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
665 |
-1, |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
666 |
pos + start, |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
667 |
pos + end, |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
668 |
capacity(), |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
669 |
offset); |
2 | 670 |
} |
671 |
||
672 |
#end[char] |
|
673 |
||
674 |
||
675 |
#if[!byte] |
|
676 |
||
677 |
public ByteOrder order() { |
|
678 |
return ByteOrder.nativeOrder(); |
|
679 |
} |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
680 |
#end[!byte] |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
681 |
#if[char] |
2 | 682 |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
683 |
ByteOrder charRegionOrder() { |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
684 |
return order(); |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
685 |
} |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
686 |
#end[char] |
2 | 687 |
} |