author | bpb |
Wed, 13 Mar 2019 11:12:22 -0700 | |
changeset 54107 | 1d7aec80147a |
parent 53959 | 1542e63eb537 |
child 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) { |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
118 |
Objects.checkIndex(index, limit() + 1); |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
119 |
Objects.checkIndex(length, limit() - index + 1); |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
120 |
return new Heap$Type$Buffer$RW$(hb, |
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
121 |
-1, |
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
122 |
0, |
53959
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 |
length, |
1542e63eb537
5071718: (bf) Add ByteBuffer.slice(int offset, int length)
bpb
parents:
53901
diff
changeset
|
125 |
index + offset); |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
126 |
} |
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
127 |
|
2 | 128 |
public $Type$Buffer duplicate() { |
129 |
return new Heap$Type$Buffer$RW$(hb, |
|
130 |
this.markValue(), |
|
131 |
this.position(), |
|
132 |
this.limit(), |
|
133 |
this.capacity(), |
|
134 |
offset); |
|
135 |
} |
|
136 |
||
137 |
public $Type$Buffer asReadOnlyBuffer() { |
|
138 |
#if[rw] |
|
139 |
return new Heap$Type$BufferR(hb, |
|
140 |
this.markValue(), |
|
141 |
this.position(), |
|
142 |
this.limit(), |
|
143 |
this.capacity(), |
|
144 |
offset); |
|
145 |
#else[rw] |
|
146 |
return duplicate(); |
|
147 |
#end[rw] |
|
148 |
} |
|
149 |
||
150 |
#if[rw] |
|
151 |
||
152 |
protected int ix(int i) { |
|
153 |
return i + offset; |
|
154 |
} |
|
155 |
||
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
156 |
#if[byte] |
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
157 |
private long byteOffset(long i) { |
36933
3e6453e2d833
8149469: ByteBuffer API and implementation enhancements for VarHandles
psandoz
parents:
33665
diff
changeset
|
158 |
return address + i; |
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
159 |
} |
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
160 |
#end[byte] |
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
161 |
|
2 | 162 |
public $type$ get() { |
163 |
return hb[ix(nextGetIndex())]; |
|
164 |
} |
|
165 |
||
166 |
public $type$ get(int i) { |
|
167 |
return hb[ix(checkIndex(i))]; |
|
168 |
} |
|
169 |
||
17922
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
170 |
#if[streamableType] |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
171 |
$type$ getUnchecked(int i) { |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
172 |
return hb[ix(i)]; |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
173 |
} |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
174 |
#end[streamableType] |
d56eec572de5
8014854: (bf) CharBuffer.chars too slow with default implementation
alanb
parents:
5506
diff
changeset
|
175 |
|
2 | 176 |
public $Type$Buffer get($type$[] dst, int offset, int length) { |
177 |
checkBounds(offset, length, dst.length); |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
178 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
179 |
if (length > limit() - pos) |
2 | 180 |
throw new BufferUnderflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
181 |
System.arraycopy(hb, ix(pos), dst, offset, length); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
182 |
position(pos + length); |
2 | 183 |
return this; |
184 |
} |
|
185 |
||
53855 | 186 |
public $Type$Buffer get(int index, $type$[] dst, int offset, int length) { |
187 |
Objects.checkFromIndexSize(index, length, limit()); |
|
188 |
Objects.checkFromIndexSize(offset, length, dst.length); |
|
189 |
System.arraycopy(hb, ix(index), dst, offset, length); |
|
190 |
return this; |
|
191 |
} |
|
192 |
||
2 | 193 |
public boolean isDirect() { |
194 |
return false; |
|
195 |
} |
|
196 |
||
197 |
#end[rw] |
|
198 |
||
199 |
public boolean isReadOnly() { |
|
200 |
return {#if[rw]?false:true}; |
|
201 |
} |
|
202 |
||
203 |
public $Type$Buffer put($type$ x) { |
|
204 |
#if[rw] |
|
205 |
hb[ix(nextPutIndex())] = x; |
|
206 |
return this; |
|
207 |
#else[rw] |
|
208 |
throw new ReadOnlyBufferException(); |
|
209 |
#end[rw] |
|
210 |
} |
|
211 |
||
212 |
public $Type$Buffer put(int i, $type$ x) { |
|
213 |
#if[rw] |
|
214 |
hb[ix(checkIndex(i))] = x; |
|
215 |
return this; |
|
216 |
#else[rw] |
|
217 |
throw new ReadOnlyBufferException(); |
|
218 |
#end[rw] |
|
219 |
} |
|
220 |
||
221 |
public $Type$Buffer put($type$[] src, int offset, int length) { |
|
222 |
#if[rw] |
|
223 |
checkBounds(offset, length, src.length); |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
224 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
225 |
if (length > limit() - pos) |
2 | 226 |
throw new BufferOverflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
227 |
System.arraycopy(src, offset, hb, ix(pos), length); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
228 |
position(pos + length); |
2 | 229 |
return this; |
230 |
#else[rw] |
|
231 |
throw new ReadOnlyBufferException(); |
|
232 |
#end[rw] |
|
233 |
} |
|
234 |
||
235 |
public $Type$Buffer put($Type$Buffer src) { |
|
236 |
#if[rw] |
|
237 |
if (src instanceof Heap$Type$Buffer) { |
|
238 |
if (src == this) |
|
31873
87b015c2cd36
8065556: (bf) Buffer.position and other methods should include detail in IAE
bpb
parents:
30338
diff
changeset
|
239 |
throw createSameBufferException(); |
2 | 240 |
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
|
241 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
242 |
int sbpos = sb.position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
243 |
int n = sb.limit() - sbpos; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
244 |
if (n > limit() - pos) |
2 | 245 |
throw new BufferOverflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
246 |
System.arraycopy(sb.hb, sb.ix(sbpos), |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
247 |
hb, ix(pos), n); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
248 |
sb.position(sbpos + n); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
249 |
position(pos + n); |
2 | 250 |
} else if (src.isDirect()) { |
251 |
int n = src.remaining(); |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
252 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
253 |
if (n > limit() - pos) |
2 | 254 |
throw new BufferOverflowException(); |
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
255 |
src.get(hb, ix(pos), n); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
256 |
position(pos + n); |
2 | 257 |
} else { |
258 |
super.put(src); |
|
259 |
} |
|
260 |
return this; |
|
261 |
#else[rw] |
|
262 |
throw new ReadOnlyBufferException(); |
|
263 |
#end[rw] |
|
264 |
} |
|
265 |
||
53855 | 266 |
public $Type$Buffer put(int index, $type$[] src, int offset, int length) { |
267 |
#if[rw] |
|
268 |
Objects.checkFromIndexSize(index, length, limit()); |
|
269 |
Objects.checkFromIndexSize(offset, length, src.length); |
|
270 |
System.arraycopy(src, offset, hb, ix(index), length); |
|
271 |
return this; |
|
272 |
#else[rw] |
|
273 |
throw new ReadOnlyBufferException(); |
|
274 |
#end[rw] |
|
275 |
} |
|
276 |
||
53901
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
277 |
#if[char] |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
278 |
|
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
279 |
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
|
280 |
int length = end - start; |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
281 |
checkBounds(start, length, src.length()); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
282 |
if (isReadOnly()) |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
283 |
throw new ReadOnlyBufferException(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
284 |
int pos = position(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
285 |
int lim = limit(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
286 |
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
|
287 |
if (length > rem) |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
288 |
throw new BufferOverflowException(); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
289 |
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
|
290 |
position(pos + length); |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
291 |
return this; |
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 |
|
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
294 |
#end[char] |
0448cb38c418
8011135: (bf) CharBuffer.put(String) is slow because of String.charAt() call for each char
bpb
parents:
53855
diff
changeset
|
295 |
|
2 | 296 |
public $Type$Buffer compact() { |
297 |
#if[rw] |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
298 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
299 |
int rem = limit() - pos; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
300 |
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
|
301 |
position(rem); |
2 | 302 |
limit(capacity()); |
1634
3871c2046043
6593946: (bf) X-Buffer.compact() does not discard mark as specified
alanb
parents:
1247
diff
changeset
|
303 |
discardMark(); |
2 | 304 |
return this; |
305 |
#else[rw] |
|
306 |
throw new ReadOnlyBufferException(); |
|
307 |
#end[rw] |
|
308 |
} |
|
309 |
||
310 |
||
311 |
||
312 |
#if[byte] |
|
313 |
||
314 |
byte _get(int i) { // package-private |
|
315 |
return hb[i]; |
|
316 |
} |
|
317 |
||
318 |
void _put(int i, byte b) { // package-private |
|
319 |
#if[rw] |
|
320 |
hb[i] = b; |
|
321 |
#else[rw] |
|
322 |
throw new ReadOnlyBufferException(); |
|
323 |
#end[rw] |
|
324 |
} |
|
325 |
||
326 |
// char |
|
327 |
||
328 |
#if[rw] |
|
329 |
||
330 |
public char getChar() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
331 |
return UNSAFE.getCharUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian); |
2 | 332 |
} |
333 |
||
334 |
public char getChar(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
335 |
return UNSAFE.getCharUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian); |
2 | 336 |
} |
337 |
||
338 |
#end[rw] |
|
339 |
||
340 |
public $Type$Buffer putChar(char x) { |
|
341 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
342 |
UNSAFE.putCharUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian); |
2 | 343 |
return this; |
344 |
#else[rw] |
|
345 |
throw new ReadOnlyBufferException(); |
|
346 |
#end[rw] |
|
347 |
} |
|
348 |
||
349 |
public $Type$Buffer putChar(int i, char x) { |
|
350 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
351 |
UNSAFE.putCharUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian); |
2 | 352 |
return this; |
353 |
#else[rw] |
|
354 |
throw new ReadOnlyBufferException(); |
|
355 |
#end[rw] |
|
356 |
} |
|
357 |
||
358 |
public CharBuffer asCharBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
359 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
360 |
int size = (limit() - pos) >> 1; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
361 |
long addr = address + pos; |
2 | 362 |
return (bigEndian |
363 |
? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this, |
|
364 |
-1, |
|
365 |
0, |
|
366 |
size, |
|
367 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
368 |
addr)) |
2 | 369 |
: (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this, |
370 |
-1, |
|
371 |
0, |
|
372 |
size, |
|
373 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
374 |
addr))); |
2 | 375 |
} |
376 |
||
377 |
||
378 |
// short |
|
379 |
||
380 |
#if[rw] |
|
381 |
||
382 |
public short getShort() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
383 |
return UNSAFE.getShortUnaligned(hb, byteOffset(nextGetIndex(2)), bigEndian); |
2 | 384 |
} |
385 |
||
386 |
public short getShort(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
387 |
return UNSAFE.getShortUnaligned(hb, byteOffset(checkIndex(i, 2)), bigEndian); |
2 | 388 |
} |
389 |
||
390 |
#end[rw] |
|
391 |
||
392 |
public $Type$Buffer putShort(short x) { |
|
393 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
394 |
UNSAFE.putShortUnaligned(hb, byteOffset(nextPutIndex(2)), x, bigEndian); |
2 | 395 |
return this; |
396 |
#else[rw] |
|
397 |
throw new ReadOnlyBufferException(); |
|
398 |
#end[rw] |
|
399 |
} |
|
400 |
||
401 |
public $Type$Buffer putShort(int i, short x) { |
|
402 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
403 |
UNSAFE.putShortUnaligned(hb, byteOffset(checkIndex(i, 2)), x, bigEndian); |
2 | 404 |
return this; |
405 |
#else[rw] |
|
406 |
throw new ReadOnlyBufferException(); |
|
407 |
#end[rw] |
|
408 |
} |
|
409 |
||
410 |
public ShortBuffer asShortBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
411 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
412 |
int size = (limit() - pos) >> 1; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
413 |
long addr = address + pos; |
2 | 414 |
return (bigEndian |
415 |
? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this, |
|
416 |
-1, |
|
417 |
0, |
|
418 |
size, |
|
419 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
420 |
addr)) |
2 | 421 |
: (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this, |
422 |
-1, |
|
423 |
0, |
|
424 |
size, |
|
425 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
426 |
addr))); |
2 | 427 |
} |
428 |
||
429 |
||
430 |
// int |
|
431 |
||
432 |
#if[rw] |
|
433 |
||
434 |
public int getInt() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
435 |
return UNSAFE.getIntUnaligned(hb, byteOffset(nextGetIndex(4)), bigEndian); |
2 | 436 |
} |
437 |
||
438 |
public int getInt(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
439 |
return UNSAFE.getIntUnaligned(hb, byteOffset(checkIndex(i, 4)), bigEndian); |
2 | 440 |
} |
441 |
||
442 |
#end[rw] |
|
443 |
||
444 |
public $Type$Buffer putInt(int x) { |
|
445 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
446 |
UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), x, bigEndian); |
2 | 447 |
return this; |
448 |
#else[rw] |
|
449 |
throw new ReadOnlyBufferException(); |
|
450 |
#end[rw] |
|
451 |
} |
|
452 |
||
453 |
public $Type$Buffer putInt(int i, int x) { |
|
454 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
455 |
UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), x, bigEndian); |
2 | 456 |
return this; |
457 |
#else[rw] |
|
458 |
throw new ReadOnlyBufferException(); |
|
459 |
#end[rw] |
|
460 |
} |
|
461 |
||
462 |
public IntBuffer asIntBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
463 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
464 |
int size = (limit() - pos) >> 2; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
465 |
long addr = address + pos; |
2 | 466 |
return (bigEndian |
467 |
? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this, |
|
468 |
-1, |
|
469 |
0, |
|
470 |
size, |
|
471 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
472 |
addr)) |
2 | 473 |
: (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this, |
474 |
-1, |
|
475 |
0, |
|
476 |
size, |
|
477 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
478 |
addr))); |
2 | 479 |
} |
480 |
||
481 |
||
482 |
// long |
|
483 |
||
484 |
#if[rw] |
|
485 |
||
486 |
public long getLong() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
487 |
return UNSAFE.getLongUnaligned(hb, byteOffset(nextGetIndex(8)), bigEndian); |
2 | 488 |
} |
489 |
||
490 |
public long getLong(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
491 |
return UNSAFE.getLongUnaligned(hb, byteOffset(checkIndex(i, 8)), bigEndian); |
2 | 492 |
} |
493 |
||
494 |
#end[rw] |
|
495 |
||
496 |
public $Type$Buffer putLong(long x) { |
|
497 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
498 |
UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), x, bigEndian); |
2 | 499 |
return this; |
500 |
#else[rw] |
|
501 |
throw new ReadOnlyBufferException(); |
|
502 |
#end[rw] |
|
503 |
} |
|
504 |
||
505 |
public $Type$Buffer putLong(int i, long x) { |
|
506 |
#if[rw] |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
507 |
UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), x, bigEndian); |
2 | 508 |
return this; |
509 |
#else[rw] |
|
510 |
throw new ReadOnlyBufferException(); |
|
511 |
#end[rw] |
|
512 |
} |
|
513 |
||
514 |
public LongBuffer asLongBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
515 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
516 |
int size = (limit() - pos) >> 3; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
517 |
long addr = address + pos; |
2 | 518 |
return (bigEndian |
519 |
? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this, |
|
520 |
-1, |
|
521 |
0, |
|
522 |
size, |
|
523 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
524 |
addr)) |
2 | 525 |
: (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this, |
526 |
-1, |
|
527 |
0, |
|
528 |
size, |
|
529 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
530 |
addr))); |
2 | 531 |
} |
532 |
||
533 |
||
534 |
// float |
|
535 |
||
536 |
#if[rw] |
|
537 |
||
538 |
public float getFloat() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
539 |
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
|
540 |
return Float.intBitsToFloat(x); |
2 | 541 |
} |
542 |
||
543 |
public float getFloat(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
544 |
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
|
545 |
return Float.intBitsToFloat(x); |
2 | 546 |
} |
547 |
||
548 |
#end[rw] |
|
549 |
||
550 |
public $Type$Buffer putFloat(float x) { |
|
551 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
552 |
int y = Float.floatToRawIntBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
553 |
UNSAFE.putIntUnaligned(hb, byteOffset(nextPutIndex(4)), y, bigEndian); |
2 | 554 |
return this; |
555 |
#else[rw] |
|
556 |
throw new ReadOnlyBufferException(); |
|
557 |
#end[rw] |
|
558 |
} |
|
559 |
||
560 |
public $Type$Buffer putFloat(int i, float x) { |
|
561 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
562 |
int y = Float.floatToRawIntBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
563 |
UNSAFE.putIntUnaligned(hb, byteOffset(checkIndex(i, 4)), y, bigEndian); |
2 | 564 |
return this; |
565 |
#else[rw] |
|
566 |
throw new ReadOnlyBufferException(); |
|
567 |
#end[rw] |
|
568 |
} |
|
569 |
||
570 |
public FloatBuffer asFloatBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
571 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
572 |
int size = (limit() - pos) >> 2; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
573 |
long addr = address + pos; |
2 | 574 |
return (bigEndian |
575 |
? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this, |
|
576 |
-1, |
|
577 |
0, |
|
578 |
size, |
|
579 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
580 |
addr)) |
2 | 581 |
: (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this, |
582 |
-1, |
|
583 |
0, |
|
584 |
size, |
|
585 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
586 |
addr))); |
2 | 587 |
} |
588 |
||
589 |
||
590 |
// double |
|
591 |
||
592 |
#if[rw] |
|
593 |
||
594 |
public double getDouble() { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
595 |
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
|
596 |
return Double.longBitsToDouble(x); |
2 | 597 |
} |
598 |
||
599 |
public double getDouble(int i) { |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
600 |
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
|
601 |
return Double.longBitsToDouble(x); |
2 | 602 |
} |
603 |
||
604 |
#end[rw] |
|
605 |
||
606 |
public $Type$Buffer putDouble(double x) { |
|
607 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
608 |
long y = Double.doubleToRawLongBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
609 |
UNSAFE.putLongUnaligned(hb, byteOffset(nextPutIndex(8)), y, bigEndian); |
2 | 610 |
return this; |
611 |
#else[rw] |
|
612 |
throw new ReadOnlyBufferException(); |
|
613 |
#end[rw] |
|
614 |
} |
|
615 |
||
616 |
public $Type$Buffer putDouble(int i, double x) { |
|
617 |
#if[rw] |
|
30338
957ee8b5a33a
8026049: (bf) Intrinsify ByteBuffer.put{Int, Double, Float, ...} methods
aph
parents:
25859
diff
changeset
|
618 |
long y = Double.doubleToRawLongBits(x); |
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
619 |
UNSAFE.putLongUnaligned(hb, byteOffset(checkIndex(i, 8)), y, bigEndian); |
2 | 620 |
return this; |
621 |
#else[rw] |
|
622 |
throw new ReadOnlyBufferException(); |
|
623 |
#end[rw] |
|
624 |
} |
|
625 |
||
626 |
public DoubleBuffer asDoubleBuffer() { |
|
54107
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
627 |
int pos = position(); |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
628 |
int size = (limit() - pos) >> 3; |
1d7aec80147a
8219597: (bf) Heap buffer state changes could provoke unexpected exceptions
bpb
parents:
53959
diff
changeset
|
629 |
long addr = address + pos; |
2 | 630 |
return (bigEndian |
631 |
? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this, |
|
632 |
-1, |
|
633 |
0, |
|
634 |
size, |
|
635 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
636 |
addr)) |
2 | 637 |
: (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this, |
638 |
-1, |
|
639 |
0, |
|
640 |
size, |
|
641 |
size, |
|
40195
a13e4945de1d
8162458: Buffer view implementations use incorrect offset for Unsafe access
psandoz
parents:
36933
diff
changeset
|
642 |
addr))); |
2 | 643 |
} |
644 |
||
645 |
||
646 |
#end[byte] |
|
647 |
||
648 |
||
649 |
#if[char] |
|
650 |
||
651 |
String toString(int start, int end) { // package-private |
|
652 |
try { |
|
653 |
return new String(hb, start + offset, end - start); |
|
654 |
} catch (StringIndexOutOfBoundsException x) { |
|
655 |
throw new IndexOutOfBoundsException(); |
|
656 |
} |
|
657 |
} |
|
658 |
||
659 |
||
660 |
// --- Methods to support CharSequence --- |
|
661 |
||
1224
8c1bc7c5dd00
6733145: (bf) CharBuffer.subSequence can be updated to take advantage of covariant returns
martin
parents:
2
diff
changeset
|
662 |
public CharBuffer subSequence(int start, int end) { |
2 | 663 |
if ((start < 0) |
664 |
|| (end > length()) |
|
665 |
|| (start > end)) |
|
666 |
throw new IndexOutOfBoundsException(); |
|
2593
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
667 |
int pos = position(); |
2 | 668 |
return new HeapCharBuffer$RW$(hb, |
2593
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
669 |
-1, |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
670 |
pos + start, |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
671 |
pos + end, |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
672 |
capacity(), |
76032557be03
6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new buffer
alanb
parents:
1634
diff
changeset
|
673 |
offset); |
2 | 674 |
} |
675 |
||
676 |
#end[char] |
|
677 |
||
678 |
||
679 |
#if[!byte] |
|
680 |
||
681 |
public ByteOrder order() { |
|
682 |
return ByteOrder.nativeOrder(); |
|
683 |
} |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
684 |
#end[!byte] |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
685 |
#if[char] |
2 | 686 |
|
48356
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
687 |
ByteOrder charRegionOrder() { |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
688 |
return order(); |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
689 |
} |
29e165bdf669
8193085: Vectorize the nio Buffer equals and compareTo implementations
psandoz
parents:
47216
diff
changeset
|
690 |
#end[char] |
2 | 691 |
} |