Showing the changes to java/pkg/java/nio/FloatBuffer.java (1 of 84 files). Show all
Unified · Split
| @@ -0,0 +1,1451 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2000, 2008, 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. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 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 | * | ||
| 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. | ||
| 24 | */ | ||
| 25 | |||
| 26 | // -- This file was mechanically generated: Do not edit! -- // | ||
| 27 | |||
| 28 | package java.nio; | ||
| 29 | |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | /** | ||
| 35 | * A float buffer. | ||
| 36 | * | ||
| 37 | * <p> This class defines four categories of operations upon | ||
| 38 | * float buffers: | ||
| 39 | * | ||
| 40 | * <ul> | ||
| 41 | * | ||
| 42 | * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and | ||
| 43 | * {@link #put(float) </code><i>put</i><code>} methods that read and write | ||
| 44 | * single floats; </p></li> | ||
| 45 | * | ||
| 46 | * <li><p> Relative {@link #get(float[]) </code><i>bulk get</i><code>} | ||
| 47 | * methods that transfer contiguous sequences of floats from this buffer | ||
| 48 | * into an array; and</p></li> | ||
| 49 | * | ||
| 50 | * <li><p> Relative {@link #put(float[]) </code><i>bulk put</i><code>} | ||
| 51 | * methods that transfer contiguous sequences of floats from a | ||
| 52 | * float array or some other float | ||
| 53 | * buffer into this buffer; and </p></li> | ||
| 54 | * | ||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | * | ||
| 68 | * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link | ||
| 69 | * #duplicate </code>duplicating<code>}, and {@link #slice | ||
| 70 | * </code>slicing<code>} a float buffer. </p></li> | ||
| 71 | * | ||
| 72 | * </ul> | ||
| 73 | * | ||
| 74 | * <p> Float buffers can be created either by {@link #allocate | ||
| 75 | * </code><i>allocation</i><code>}, which allocates space for the buffer's | ||
| 76 | * | ||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | * | ||
| 84 | * content, by {@link #wrap(float[]) </code><i>wrapping</i><code>} an existing | ||
| 85 | * float array into a buffer, or by creating a | ||
| 86 | * <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer. | ||
| 87 | * | ||
| 88 | |||
| 89 | * | ||
| 90 | |||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | |||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | |||
| 123 | |||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | |||
| 135 | |||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | |||
| 143 | |||
| 144 | |||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | |||
| 149 | |||
| 150 | |||
| 151 | |||
| 152 | |||
| 153 | |||
| 154 | |||
| 155 | |||
| 156 | |||
| 157 | |||
| 158 | |||
| 159 | |||
| 160 | |||
| 161 | |||
| 162 | |||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | |||
| 167 | |||
| 168 | |||
| 169 | |||
| 170 | |||
| 171 | |||
| 172 | |||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | |||
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | |||
| 181 | |||
| 182 | |||
| 183 | |||
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | |||
| 188 | |||
| 189 | * | ||
| 190 | |||
| 191 | * | ||
| 192 | * <p> Like a byte buffer, a float buffer is either <a | ||
| 193 | * href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A | ||
| 194 | * float buffer created via the <tt>wrap</tt> methods of this class will | ||
| 195 | * be non-direct. A float buffer created as a view of a byte buffer will | ||
| 196 | * be direct if, and only if, the byte buffer itself is direct. Whether or not | ||
| 197 | * a float buffer is direct may be determined by invoking the {@link | ||
| 198 | * #isDirect isDirect} method. </p> | ||
| 199 | * | ||
| 200 | |||
| 201 | * | ||
| 202 | |||
| 203 | |||
| 204 | |||
| 205 | |||
| 206 | |||
| 207 | |||
| 208 | |||
| 209 | |||
| 210 | * | ||
| 211 | |||
| 212 | |||
| 213 | |||
| 214 | * | ||
| 215 | * <p> Methods in this class that do not otherwise have a value to return are | ||
| 216 | * specified to return the buffer upon which they are invoked. This allows | ||
| 217 | * method invocations to be chained. | ||
| 218 | * | ||
| 219 | |||
| 220 | |||
| 221 | |||
| 222 | |||
| 223 | |||
| 224 | |||
| 225 | |||
| 226 | |||
| 227 | |||
| 228 | |||
| 229 | |||
| 230 | |||
| 231 | |||
| 232 | |||
| 233 | |||
| 234 | |||
| 235 | |||
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | |||
| 240 | |||
| 241 | |||
| 242 | |||
| 243 | |||
| 244 | |||
| 245 | |||
| 246 | |||
| 247 | |||
| 248 | |||
| 249 | |||
| 250 | * | ||
| 251 | * | ||
| 252 | * @author Mark Reinhold | ||
| 253 | * @author JSR-51 Expert Group | ||
| 254 | * @since 1.4 | ||
| 255 | */ | ||
| 256 | |||
| 257 | public abstract class FloatBuffer | ||
| 258 | extends Buffer | ||
| 259 | implements Comparable<FloatBuffer> | ||
| 260 | { | ||
| 261 | |||
| 262 | // These fields are declared here rather than in Heap-X-Buffer in order to | ||
| 263 | // reduce the number of virtual method invocations needed to access these | ||
| 264 | // values, which is especially costly when coding small buffers. | ||
| 265 | // | ||
| 266 | final float[] hb; // Non-null only for heap buffers | ||
| 267 | final int offset; | ||
| 268 | boolean isReadOnly; // Valid only for heap buffers | ||
| 269 | |||
| 270 | // Creates a new buffer with the given mark, position, limit, capacity, | ||
| 271 | // backing array, and array offset | ||
| 272 | // | ||
| 273 | FloatBuffer(int mark, int pos, int lim, int cap, // package-private | ||
| 274 | float[] hb, int offset) | ||
| 275 | { | ||
| 276 | super(mark, pos, lim, cap); | ||
| 277 | this.hb = hb; | ||
| 278 | this.offset = offset; | ||
| 279 | } | ||
| 280 | |||
| 281 | // Creates a new buffer with the given mark, position, limit, and capacity | ||
| 282 | // | ||
| 283 | FloatBuffer(int mark, int pos, int lim, int cap) { // package-private | ||
| 284 | this(mark, pos, lim, cap, null, 0); | ||
| 285 | } | ||
| 286 | |||
| 287 | |||
| 288 | |||
| 289 | |||
| 290 | |||
| 291 | |||
| 292 | |||
| 293 | |||
| 294 | |||
| 295 | |||
| 296 | |||
| 297 | |||
| 298 | |||
| 299 | |||
| 300 | |||
| 301 | |||
| 302 | |||
| 303 | |||
| 304 | |||
| 305 | |||
| 306 | |||
| 307 | |||
| 308 | |||
| 309 | |||
| 310 | |||
| 311 | /** | ||
| 312 | * Allocates a new float buffer. | ||
| 313 | * | ||
| 314 | * <p> The new buffer's position will be zero, its limit will be its | ||
| 315 | * capacity, its mark will be undefined, and each of its elements will be | ||
| 316 | * initialized to zero. It will have a {@link #array | ||
| 317 | * </code>backing array<code>}, and its {@link #arrayOffset </code>array | ||
| 318 | * offset<code>} will be zero. | ||
| 319 | * | ||
| 320 | * @param capacity | ||
| 321 | * The new buffer's capacity, in floats | ||
| 322 | * | ||
| 323 | * @return The new float buffer | ||
| 324 | * | ||
| 325 | * @throws IllegalArgumentException | ||
| 326 | * If the <tt>capacity</tt> is a negative integer | ||
| 327 | */ | ||
| 328 | public static FloatBuffer allocate(int capacity) { | ||
| 329 | if (capacity < 0) | ||
| 330 | throw new IllegalArgumentException(); | ||
| 331 | return new HeapFloatBuffer(capacity, capacity); | ||
| 332 | } | ||
| 333 | |||
| 334 | /** | ||
| 335 | * Wraps a float array into a buffer. | ||
| 336 | * | ||
| 337 | * <p> The new buffer will be backed by the given float array; | ||
| 338 | * that is, modifications to the buffer will cause the array to be modified | ||
| 339 | * and vice versa. The new buffer's capacity will be | ||
| 340 | * <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit | ||
| 341 | * will be <tt>offset + length</tt>, and its mark will be undefined. Its | ||
| 342 | * {@link #array </code>backing array<code>} will be the given array, and | ||
| 343 | * its {@link #arrayOffset </code>array offset<code>} will be zero. </p> | ||
| 344 | * | ||
| 345 | * @param array | ||
| 346 | * The array that will back the new buffer | ||
| 347 | * | ||
| 348 | * @param offset | ||
| 349 | * The offset of the subarray to be used; must be non-negative and | ||
| 350 | * no larger than <tt>array.length</tt>. The new buffer's position | ||
| 351 | * will be set to this value. | ||
| 352 | * | ||
| 353 | * @param length | ||
| 354 | * The length of the subarray to be used; | ||
| 355 | * must be non-negative and no larger than | ||
| 356 | * <tt>array.length - offset</tt>. | ||
| 357 | * The new buffer's limit will be set to <tt>offset + length</tt>. | ||
| 358 | * | ||
| 359 | * @return The new float buffer | ||
| 360 | * | ||
| 361 | * @throws IndexOutOfBoundsException | ||
| 362 | * If the preconditions on the <tt>offset</tt> and <tt>length</tt> | ||
| 363 | * parameters do not hold | ||
| 364 | */ | ||
| 365 | public static FloatBuffer wrap(float[] array, | ||
| 366 | int offset, int length) | ||
| 367 | { | ||
| 368 | try { | ||
| 369 | return new HeapFloatBuffer(array, offset, length); | ||
| 370 | } catch (IllegalArgumentException x) { | ||
| 371 | throw new IndexOutOfBoundsException(); | ||
| 372 | } | ||
| 373 | } | ||
| 374 | |||
| 375 | /** | ||
| 376 | * Wraps a float array into a buffer. | ||
| 377 | * | ||
| 378 | * <p> The new buffer will be backed by the given float array; | ||
| 379 | * that is, modifications to the buffer will cause the array to be modified | ||
| 380 | * and vice versa. The new buffer's capacity and limit will be | ||
| 381 | * <tt>array.length</tt>, its position will be zero, and its mark will be | ||
| 382 | * undefined. Its {@link #array </code>backing array<code>} will be the | ||
| 383 | * given array, and its {@link #arrayOffset </code>array offset<code>} will | ||
| 384 | * be zero. </p> | ||
| 385 | * | ||
| 386 | * @param array | ||
| 387 | * The array that will back this buffer | ||
| 388 | * | ||
| 389 | * @return The new float buffer | ||
| 390 | */ | ||
| 391 | public static FloatBuffer wrap(float[] array) { | ||
| 392 | return wrap(array, 0, array.length); | ||
| 393 | } | ||
| 394 | |||
| 395 | |||
| 396 | |||
| 397 | |||
| 398 | |||
| 399 | |||
| 400 | |||
| 401 | |||
| 402 | |||
| 403 | |||
| 404 | |||
| 405 | |||
| 406 | |||
| 407 | |||
| 408 | |||
| 409 | |||
| 410 | |||
| 411 | |||
| 412 | |||
| 413 | |||
| 414 | |||
| 415 | |||
| 416 | |||
| 417 | |||
| 418 | |||
| 419 | |||
| 420 | |||
| 421 | |||
| 422 | |||
| 423 | |||
| 424 | |||
| 425 | |||
| 426 | |||
| 427 | |||
| 428 | |||
| 429 | |||
| 430 | |||
| 431 | |||
| 432 | |||
| 433 | |||
| 434 | |||
| 435 | |||
| 436 | |||
| 437 | |||
| 438 | |||
| 439 | |||
| 440 | |||
| 441 | |||
| 442 | |||
| 443 | |||
| 444 | |||
| 445 | |||
| 446 | |||
| 447 | |||
| 448 | |||
| 449 | |||
| 450 | |||
| 451 | |||
| 452 | |||
| 453 | |||
| 454 | |||
| 455 | |||
| 456 | |||
| 457 | |||
| 458 | |||
| 459 | |||
| 460 | |||
| 461 | |||
| 462 | |||
| 463 | |||
| 464 | |||
| 465 | |||
| 466 | |||
| 467 | |||
| 468 | |||
| 469 | |||
| 470 | |||
| 471 | |||
| 472 | |||
| 473 | |||
| 474 | |||
| 475 | |||
| 476 | |||
| 477 | |||
| 478 | |||
| 479 | |||
| 480 | |||
| 481 | |||
| 482 | |||
| 483 | |||
| 484 | |||
| 485 | |||
| 486 | |||
| 487 | |||
| 488 | /** | ||
| 489 | * Creates a new float buffer whose content is a shared subsequence of | ||
| 490 | * this buffer's content. | ||
| 491 | * | ||
| 492 | * <p> The content of the new buffer will start at this buffer's current | ||
| 493 | * position. Changes to this buffer's content will be visible in the new | ||
| 494 | * buffer, and vice versa; the two buffers' position, limit, and mark | ||
| 495 | * values will be independent. | ||
| 496 | * | ||
| 497 | * <p> The new buffer's position will be zero, its capacity and its limit | ||
| 498 | * will be the number of floats remaining in this buffer, and its mark | ||
| 499 | * will be undefined. The new buffer will be direct if, and only if, this | ||
| 500 | * buffer is direct, and it will be read-only if, and only if, this buffer | ||
| 501 | * is read-only. </p> | ||
| 502 | * | ||
| 503 | * @return The new float buffer | ||
| 504 | */ | ||
| 505 | public abstract FloatBuffer slice(); | ||
| 506 | |||
| 507 | /** | ||
| 508 | * Creates a new float buffer that shares this buffer's content. | ||
| 509 | * | ||
| 510 | * <p> The content of the new buffer will be that of this buffer. Changes | ||
| 511 | * to this buffer's content will be visible in the new buffer, and vice | ||
| 512 | * versa; the two buffers' position, limit, and mark values will be | ||
| 513 | * independent. | ||
| 514 | * | ||
| 515 | * <p> The new buffer's capacity, limit, position, and mark values will be | ||
| 516 | * identical to those of this buffer. The new buffer will be direct if, | ||
| 517 | * and only if, this buffer is direct, and it will be read-only if, and | ||
| 518 | * only if, this buffer is read-only. </p> | ||
| 519 | * | ||
| 520 | * @return The new float buffer | ||
| 521 | */ | ||
| 522 | public abstract FloatBuffer duplicate(); | ||
| 523 | |||
| 524 | /** | ||
| 525 | * Creates a new, read-only float buffer that shares this buffer's | ||
| 526 | * content. | ||
| 527 | * | ||
| 528 | * <p> The content of the new buffer will be that of this buffer. Changes | ||
| 529 | * to this buffer's content will be visible in the new buffer; the new | ||
| 530 | * buffer itself, however, will be read-only and will not allow the shared | ||
| 531 | * content to be modified. The two buffers' position, limit, and mark | ||
| 532 | * values will be independent. | ||
| 533 | * | ||
| 534 | * <p> The new buffer's capacity, limit, position, and mark values will be | ||
| 535 | * identical to those of this buffer. | ||
| 536 | * | ||
| 537 | * <p> If this buffer is itself read-only then this method behaves in | ||
| 538 | * exactly the same way as the {@link #duplicate duplicate} method. </p> | ||
| 539 | * | ||
| 540 | * @return The new, read-only float buffer | ||
| 541 | */ | ||
| 542 | public abstract FloatBuffer asReadOnlyBuffer(); | ||
| 543 | |||
| 544 | |||
| 545 | // -- Singleton get/put methods -- | ||
| 546 | |||
| 547 | /** | ||
| 548 | * Relative <i>get</i> method. Reads the float at this buffer's | ||
| 549 | * current position, and then increments the position. </p> | ||
| 550 | * | ||
| 551 | * @return The float at the buffer's current position | ||
| 552 | * | ||
| 553 | * @throws BufferUnderflowException | ||
| 554 | * If the buffer's current position is not smaller than its limit | ||
| 555 | */ | ||
| 556 | public abstract float get(); | ||
| 557 | |||
| 558 | /** | ||
| 559 | * Relative <i>put</i> method <i>(optional operation)</i>. | ||
| 560 | * | ||
| 561 | * <p> Writes the given float into this buffer at the current | ||
| 562 | * position, and then increments the position. </p> | ||
| 563 | * | ||
| 564 | * @param f | ||
| 565 | * The float to be written | ||
| 566 | * | ||
| 567 | * @return This buffer | ||
| 568 | * | ||
| 569 | * @throws BufferOverflowException | ||
| 570 | * If this buffer's current position is not smaller than its limit | ||
| 571 | * | ||
| 572 | * @throws ReadOnlyBufferException | ||
| 573 | * If this buffer is read-only | ||
| 574 | */ | ||
| 575 | public abstract FloatBuffer put(float f); | ||
| 576 | |||
| 577 | /** | ||
| 578 | * Absolute <i>get</i> method. Reads the float at the given | ||
| 579 | * index. </p> | ||
| 580 | * | ||
| 581 | * @param index | ||
| 582 | * The index from which the float will be read | ||
| 583 | * | ||
| 584 | * @return The float at the given index | ||
| 585 | * | ||
| 586 | * @throws IndexOutOfBoundsException | ||
| 587 | * If <tt>index</tt> is negative | ||
| 588 | * or not smaller than the buffer's limit | ||
| 589 | */ | ||
| 590 | public abstract float get(int index); | ||
| 591 | |||
| 592 | /** | ||
| 593 | * Absolute <i>put</i> method <i>(optional operation)</i>. | ||
| 594 | * | ||
| 595 | * <p> Writes the given float into this buffer at the given | ||
| 596 | * index. </p> | ||
| 597 | * | ||
| 598 | * @param index | ||
| 599 | * The index at which the float will be written | ||
| 600 | * | ||
| 601 | * @param f | ||
| 602 | * The float value to be written | ||
| 603 | * | ||
| 604 | * @return This buffer | ||
| 605 | * | ||
| 606 | * @throws IndexOutOfBoundsException | ||
| 607 | * If <tt>index</tt> is negative | ||
| 608 | * or not smaller than the buffer's limit | ||
| 609 | * | ||
| 610 | * @throws ReadOnlyBufferException | ||
| 611 | * If this buffer is read-only | ||
| 612 | */ | ||
| 613 | public abstract FloatBuffer put(int index, float f); | ||
| 614 | |||
| 615 | |||
| 616 | // -- Bulk get operations -- | ||
| 617 | |||
| 618 | /** | ||
| 619 | * Relative bulk <i>get</i> method. | ||
| 620 | * | ||
| 621 | * <p> This method transfers floats from this buffer into the given | ||
| 622 | * destination array. If there are fewer floats remaining in the | ||
| 623 | * buffer than are required to satisfy the request, that is, if | ||
| 624 | * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no | ||
| 625 | * floats are transferred and a {@link BufferUnderflowException} is | ||
| 626 | * thrown. | ||
| 627 | * | ||
| 628 | * <p> Otherwise, this method copies <tt>length</tt> floats from this | ||
| 629 | * buffer into the given array, starting at the current position of this | ||
| 630 | * buffer and at the given offset in the array. The position of this | ||
| 631 | * buffer is then incremented by <tt>length</tt>. | ||
| 632 | * | ||
| 633 | * <p> In other words, an invocation of this method of the form | ||
| 634 | * <tt>src.get(dst, off, len)</tt> has exactly the same effect as | ||
| 635 | * the loop | ||
| 636 | * | ||
| 637 | * <pre> | ||
| 638 | * for (int i = off; i < off + len; i++) | ||
| 639 | * dst[i] = src.get(); </pre> | ||
| 640 | * | ||
| 641 | * except that it first checks that there are sufficient floats in | ||
| 642 | * this buffer and it is potentially much more efficient. </p> | ||
| 643 | * | ||
| 644 | * @param dst | ||
| 645 | * The array into which floats are to be written | ||
| 646 | * | ||
| 647 | * @param offset | ||
| 648 | * The offset within the array of the first float to be | ||
| 649 | * written; must be non-negative and no larger than | ||
| 650 | * <tt>dst.length</tt> | ||
| 651 | * | ||
| 652 | * @param length | ||
| 653 | * The maximum number of floats to be written to the given | ||
| 654 | * array; must be non-negative and no larger than | ||
| 655 | * <tt>dst.length - offset</tt> | ||
| 656 | * | ||
| 657 | * @return This buffer | ||
| 658 | * | ||
| 659 | * @throws BufferUnderflowException | ||
| 660 | * If there are fewer than <tt>length</tt> floats | ||
| 661 | * remaining in this buffer | ||
| 662 | * | ||
| 663 | * @throws IndexOutOfBoundsException | ||
| 664 | * If the preconditions on the <tt>offset</tt> and <tt>length</tt> | ||
| 665 | * parameters do not hold | ||
| 666 | */ | ||
| 667 | public FloatBuffer get(float[] dst, int offset, int length) { | ||
| 668 | checkBounds(offset, length, dst.length); | ||
| 669 | if (length > remaining()) | ||
| 670 | throw new BufferUnderflowException(); | ||
| 671 | int end = offset + length; | ||
| 672 | for (int i = offset; i < end; i++) | ||
| 673 | dst[i] = get(); | ||
| 674 | return this; | ||
| 675 | } | ||
| 676 | |||
| 677 | /** | ||
| 678 | * Relative bulk <i>get</i> method. | ||
| 679 | * | ||
| 680 | * <p> This method transfers floats from this buffer into the given | ||
| 681 | * destination array. An invocation of this method of the form | ||
| 682 | * <tt>src.get(a)</tt> behaves in exactly the same way as the invocation | ||
| 683 | * | ||
| 684 | * <pre> | ||
| 685 | * src.get(a, 0, a.length) </pre> | ||
| 686 | * | ||
| 687 | * @return This buffer | ||
| 688 | * | ||
| 689 | * @throws BufferUnderflowException | ||
| 690 | * If there are fewer than <tt>length</tt> floats | ||
| 691 | * remaining in this buffer | ||
| 692 | */ | ||
| 693 | public FloatBuffer get(float[] dst) { | ||
| 694 | return get(dst, 0, dst.length); | ||
| 695 | } | ||
| 696 | |||
| 697 | |||
| 698 | // -- Bulk put operations -- | ||
| 699 | |||
| 700 | /** | ||
| 701 | * Relative bulk <i>put</i> method <i>(optional operation)</i>. | ||
| 702 | * | ||
| 703 | * <p> This method transfers the floats remaining in the given source | ||
| 704 | * buffer into this buffer. If there are more floats remaining in the | ||
| 705 | * source buffer than in this buffer, that is, if | ||
| 706 | * <tt>src.remaining()</tt> <tt>></tt> <tt>remaining()</tt>, | ||
| 707 | * then no floats are transferred and a {@link | ||
| 708 | * BufferOverflowException} is thrown. | ||
| 709 | * | ||
| 710 | * <p> Otherwise, this method copies | ||
| 711 | * <i>n</i> = <tt>src.remaining()</tt> floats from the given | ||
| 712 | * buffer into this buffer, starting at each buffer's current position. | ||
| 713 | * The positions of both buffers are then incremented by <i>n</i>. | ||
| 714 | * | ||
| 715 | * <p> In other words, an invocation of this method of the form | ||
| 716 | * <tt>dst.put(src)</tt> has exactly the same effect as the loop | ||
| 717 | * | ||
| 718 | * <pre> | ||
| 719 | * while (src.hasRemaining()) | ||
| 720 | * dst.put(src.get()); </pre> | ||
| 721 | * | ||
| 722 | * except that it first checks that there is sufficient space in this | ||
| 723 | * buffer and it is potentially much more efficient. </p> | ||
| 724 | * | ||
| 725 | * @param src | ||
| 726 | * The source buffer from which floats are to be read; | ||
| 727 | * must not be this buffer | ||
| 728 | * | ||
| 729 | * @return This buffer | ||
| 730 | * | ||
| 731 | * @throws BufferOverflowException | ||
| 732 | * If there is insufficient space in this buffer | ||
| 733 | * for the remaining floats in the source buffer | ||
| 734 | * | ||
| 735 | * @throws IllegalArgumentException | ||
| 736 | * If the source buffer is this buffer | ||
| 737 | * | ||
| 738 | * @throws ReadOnlyBufferException | ||
| 739 | * If this buffer is read-only | ||
| 740 | */ | ||
| 741 | public FloatBuffer put(FloatBuffer src) { | ||
| 742 | if (src == this) | ||
| 743 | throw new IllegalArgumentException(); | ||
| 744 | int n = src.remaining(); | ||
| 745 | if (n > remaining()) | ||
| 746 | throw new BufferOverflowException(); | ||
| 747 | for (int i = 0; i < n; i++) | ||
| 748 | put(src.get()); | ||
| 749 | return this; | ||
| 750 | } | ||
| 751 | |||
| 752 | /** | ||
| 753 | * Relative bulk <i>put</i> method <i>(optional operation)</i>. | ||
| 754 | * | ||
| 755 | * <p> This method transfers floats into this buffer from the given | ||
| 756 | * source array. If there are more floats to be copied from the array | ||
| 757 | * than remain in this buffer, that is, if | ||
| 758 | * <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no | ||
| 759 | * floats are transferred and a {@link BufferOverflowException} is | ||
| 760 | * thrown. | ||
| 761 | * | ||
| 762 | * <p> Otherwise, this method copies <tt>length</tt> floats from the | ||
| 763 | * given array into this buffer, starting at the given offset in the array | ||
| 764 | * and at the current position of this buffer. The position of this buffer | ||
| 765 | * is then incremented by <tt>length</tt>. | ||
| 766 | * | ||
| 767 | * <p> In other words, an invocation of this method of the form | ||
| 768 | * <tt>dst.put(src, off, len)</tt> has exactly the same effect as | ||
| 769 | * the loop | ||
| 770 | * | ||
| 771 | * <pre> | ||
| 772 | * for (int i = off; i < off + len; i++) | ||
| 773 | * dst.put(a[i]); </pre> | ||
| 774 | * | ||
| 775 | * except that it first checks that there is sufficient space in this | ||
| 776 | * buffer and it is potentially much more efficient. </p> | ||
| 777 | * | ||
| 778 | * @param src | ||
| 779 | * The array from which floats are to be read | ||
| 780 | * | ||
| 781 | * @param offset | ||
| 782 | * The offset within the array of the first float to be read; | ||
| 783 | * must be non-negative and no larger than <tt>array.length</tt> | ||
| 784 | * | ||
| 785 | * @param length | ||
| 786 | * The number of floats to be read from the given array; | ||
| 787 | * must be non-negative and no larger than | ||
| 788 | * <tt>array.length - offset</tt> | ||
| 789 | * | ||
| 790 | * @return This buffer | ||
| 791 | * | ||
| 792 | * @throws BufferOverflowException | ||
| 793 | * If there is insufficient space in this buffer | ||
| 794 | * | ||
| 795 | * @throws IndexOutOfBoundsException | ||
| 796 | * If the preconditions on the <tt>offset</tt> and <tt>length</tt> | ||
| 797 | * parameters do not hold | ||
| 798 | * | ||
| 799 | * @throws ReadOnlyBufferException | ||
| 800 | * If this buffer is read-only | ||
| 801 | */ | ||
| 802 | public FloatBuffer put(float[] src, int offset, int length) { | ||
| 803 | checkBounds(offset, length, src.length); | ||
| 804 | if (length > remaining()) | ||
| 805 | throw new BufferOverflowException(); | ||
| 806 | int end = offset + length; | ||
| 807 | for (int i = offset; i < end; i++) | ||
| 808 | this.put(src[i]); | ||
| 809 | return this; | ||
| 810 | } | ||
| 811 | |||
| 812 | /** | ||
| 813 | * Relative bulk <i>put</i> method <i>(optional operation)</i>. | ||
| 814 | * | ||
| 815 | * <p> This method transfers the entire content of the given source | ||
| 816 | * float array into this buffer. An invocation of this method of the | ||
| 817 | * form <tt>dst.put(a)</tt> behaves in exactly the same way as the | ||
| 818 | * invocation | ||
| 819 | * | ||
| 820 | * <pre> | ||
| 821 | * dst.put(a, 0, a.length) </pre> | ||
| 822 | * | ||
| 823 | * @return This buffer | ||
| 824 | * | ||
| 825 | * @throws BufferOverflowException | ||
| 826 | * If there is insufficient space in this buffer | ||
| 827 | * | ||
| 828 | * @throws ReadOnlyBufferException | ||
| 829 | * If this buffer is read-only | ||
| 830 | */ | ||
| 831 | public final FloatBuffer put(float[] src) { | ||
| 832 | return put(src, 0, src.length); | ||
| 833 | } | ||
| 834 | |||
| 835 | |||
| 836 | |||
| 837 | |||
| 838 | |||
| 839 | |||
| 840 | |||
| 841 | |||
| 842 | |||
| 843 | |||
| 844 | |||
| 845 | |||
| 846 | |||
| 847 | |||
| 848 | |||
| 849 | |||
| 850 | |||
| 851 | |||
| 852 | |||
| 853 | |||
| 854 | |||
| 855 | |||
| 856 | |||
| 857 | |||
| 858 | |||
| 859 | |||
| 860 | |||
| 861 | |||
| 862 | |||
| 863 | |||
| 864 | |||
| 865 | |||
| 866 | |||
| 867 | |||
| 868 | |||
| 869 | |||
| 870 | |||
| 871 | |||
| 872 | |||
| 873 | |||
| 874 | |||
| 875 | |||
| 876 | |||
| 877 | |||
| 878 | |||
| 879 | |||
| 880 | |||
| 881 | |||
| 882 | |||
| 883 | |||
| 884 | |||
| 885 | |||
| 886 | |||
| 887 | |||
| 888 | |||
| 889 | |||
| 890 | |||
| 891 | |||
| 892 | |||
| 893 | |||
| 894 | |||
| 895 | |||
| 896 | |||
| 897 | |||
| 898 | |||
| 899 | |||
| 900 | |||
| 901 | |||
| 902 | |||
| 903 | |||
| 904 | |||
| 905 | |||
| 906 | |||
| 907 | |||
| 908 | |||
| 909 | |||
| 910 | |||
| 911 | |||
| 912 | |||
| 913 | |||
| 914 | |||
| 915 | |||
| 916 | |||
| 917 | |||
| 918 | |||
| 919 | |||
| 920 | |||
| 921 | // -- Other stuff -- | ||
| 922 | |||
| 923 | /** | ||
| 924 | * Tells whether or not this buffer is backed by an accessible float | ||
| 925 | * array. | ||
| 926 | * | ||
| 927 | * <p> If this method returns <tt>true</tt> then the {@link #array() array} | ||
| 928 | * and {@link #arrayOffset() arrayOffset} methods may safely be invoked. | ||
| 929 | * </p> | ||
| 930 | * | ||
| 931 | * @return <tt>true</tt> if, and only if, this buffer | ||
| 932 | * is backed by an array and is not read-only | ||
| 933 | */ | ||
| 934 | public final boolean hasArray() { | ||
| 935 | return (hb != null) && !isReadOnly; | ||
| 936 | } | ||
| 937 | |||
| 938 | /** | ||
| 939 | * Returns the float array that backs this | ||
| 940 | * buffer <i>(optional operation)</i>. | ||
| 941 | * | ||
| 942 | * <p> Modifications to this buffer's content will cause the returned | ||
| 943 | * array's content to be modified, and vice versa. | ||
| 944 | * | ||
| 945 | * <p> Invoke the {@link #hasArray hasArray} method before invoking this | ||
| 946 | * method in order to ensure that this buffer has an accessible backing | ||
| 947 | * array. </p> | ||
| 948 | * | ||
| 949 | * @return The array that backs this buffer | ||
| 950 | * | ||
| 951 | * @throws ReadOnlyBufferException | ||
| 952 | * If this buffer is backed by an array but is read-only | ||
| 953 | * | ||
| 954 | * @throws UnsupportedOperationException | ||
| 955 | * If this buffer is not backed by an accessible array | ||
| 956 | */ | ||
| 957 | public final float[] array() { | ||
| 958 | if (hb == null) | ||
| 959 | throw new UnsupportedOperationException(); | ||
| 960 | if (isReadOnly) | ||
| 961 | throw new ReadOnlyBufferException(); | ||
| 962 | return hb; | ||
| 963 | } | ||
| 964 | |||
| 965 | /** | ||
| 966 | * Returns the offset within this buffer's backing array of the first | ||
| 967 | * element of the buffer <i>(optional operation)</i>. | ||
| 968 | * | ||
| 969 | * <p> If this buffer is backed by an array then buffer position <i>p</i> | ||
| 970 | * corresponds to array index <i>p</i> + <tt>arrayOffset()</tt>. | ||
| 971 | * | ||
| 972 | * <p> Invoke the {@link #hasArray hasArray} method before invoking this | ||
| 973 | * method in order to ensure that this buffer has an accessible backing | ||
| 974 | * array. </p> | ||
| 975 | * | ||
| 976 | * @return The offset within this buffer's array | ||
| 977 | * of the first element of the buffer | ||
| 978 | * | ||
| 979 | * @throws ReadOnlyBufferException | ||
| 980 | * If this buffer is backed by an array but is read-only | ||
| 981 | * | ||
| 982 | * @throws UnsupportedOperationException | ||
| 983 | * If this buffer is not backed by an accessible array | ||
| 984 | */ | ||
| 985 | public final int arrayOffset() { | ||
| 986 | if (hb == null) | ||
| 987 | throw new UnsupportedOperationException(); | ||
| 988 | if (isReadOnly) | ||
| 989 | throw new ReadOnlyBufferException(); | ||
| 990 | return offset; | ||
| 991 | } | ||
| 992 | |||
| 993 | /** | ||
| 994 | * Compacts this buffer <i>(optional operation)</i>. | ||
| 995 | * | ||
| 996 | * <p> The floats between the buffer's current position and its limit, | ||
| 997 | * if any, are copied to the beginning of the buffer. That is, the | ||
| 998 | * float at index <i>p</i> = <tt>position()</tt> is copied | ||
| 999 | * to index zero, the float at index <i>p</i> + 1 is copied | ||
| 1000 | * to index one, and so forth until the float at index | ||
| 1001 | * <tt>limit()</tt> - 1 is copied to index | ||
| 1002 | * <i>n</i> = <tt>limit()</tt> - <tt>1</tt> - <i>p</i>. | ||
| 1003 | * The buffer's position is then set to <i>n+1</i> and its limit is set to | ||
| 1004 | * its capacity. The mark, if defined, is discarded. | ||
| 1005 | * | ||
| 1006 | * <p> The buffer's position is set to the number of floats copied, | ||
| 1007 | * rather than to zero, so that an invocation of this method can be | ||
| 1008 | * followed immediately by an invocation of another relative <i>put</i> | ||
| 1009 | * method. </p> | ||
| 1010 | * | ||
| 1011 | |||
| 1012 | |||
| 1013 | |||
| 1014 | |||
| 1015 | |||
| 1016 | |||
| 1017 | |||
| 1018 | |||
| 1019 | |||
| 1020 | |||
| 1021 | |||
| 1022 | |||
| 1023 | |||
| 1024 | |||
| 1025 | |||
| 1026 | * | ||
| 1027 | * @return This buffer | ||
| 1028 | * | ||
| 1029 | * @throws ReadOnlyBufferException | ||
| 1030 | * If this buffer is read-only | ||
| 1031 | */ | ||
| 1032 | public abstract FloatBuffer compact(); | ||
| 1033 | |||
| 1034 | /** | ||
| 1035 | * Tells whether or not this float buffer is direct. </p> | ||
| 1036 | * | ||
| 1037 | * @return <tt>true</tt> if, and only if, this buffer is direct | ||
| 1038 | */ | ||
| 1039 | public abstract boolean isDirect(); | ||
| 1040 | |||
| 1041 | |||
| 1042 | |||
| 1043 | /** | ||
| 1044 | * Returns a string summarizing the state of this buffer. </p> | ||
| 1045 | * | ||
| 1046 | * @return A summary string | ||
| 1047 | */ | ||
| 1048 | public String toString() { | ||
| 1049 | StringBuffer sb = new StringBuffer(); | ||
| 1050 | sb.append(getClass().getName()); | ||
| 1051 | sb.append("[pos="); | ||
| 1052 | sb.append(position()); | ||
| 1053 | sb.append(" lim="); | ||
| 1054 | sb.append(limit()); | ||
| 1055 | sb.append(" cap="); | ||
| 1056 | sb.append(capacity()); | ||
| 1057 | sb.append("]"); | ||
| 1058 | return sb.toString(); | ||
| 1059 | } | ||
| 1060 | |||
| 1061 | |||
| 1062 | |||
| 1063 | |||
| 1064 | |||
| 1065 | |||
| 1066 | /** | ||
| 1067 | * Returns the current hash code of this buffer. | ||
| 1068 | * | ||
| 1069 | * <p> The hash code of a float buffer depends only upon its remaining | ||
| 1070 | * elements; that is, upon the elements from <tt>position()</tt> up to, and | ||
| 1071 | * including, the element at <tt>limit()</tt> - <tt>1</tt>. | ||
| 1072 | * | ||
| 1073 | * <p> Because buffer hash codes are content-dependent, it is inadvisable | ||
| 1074 | * to use buffers as keys in hash maps or similar data structures unless it | ||
| 1075 | * is known that their contents will not change. </p> | ||
| 1076 | * | ||
| 1077 | * @return The current hash code of this buffer | ||
| 1078 | */ | ||
| 1079 | public int hashCode() { | ||
| 1080 | int h = 1; | ||
| 1081 | int p = position(); | ||
| 1082 | for (int i = limit() - 1; i >= p; i--) | ||
| 1083 | h = 31 * h + (int)get(i); | ||
| 1084 | return h; | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | /** | ||
| 1088 | * Tells whether or not this buffer is equal to another object. | ||
| 1089 | * | ||
| 1090 | * <p> Two float buffers are equal if, and only if, | ||
| 1091 | * | ||
| 1092 | * <p><ol> | ||
| 1093 | * | ||
| 1094 | * <li><p> They have the same element type, </p></li> | ||
| 1095 | * | ||
| 1096 | * <li><p> They have the same number of remaining elements, and | ||
| 1097 | * </p></li> | ||
| 1098 | * | ||
| 1099 | * <li><p> The two sequences of remaining elements, considered | ||
| 1100 | * independently of their starting positions, are pointwise equal. | ||
| 1101 | |||
| 1102 | * This method considers two float elements {@code a} and {@code b} | ||
| 1103 | * to be equal if | ||
| 1104 | * {@code (a == b) || (Float.isNaN(a) && Float.isNaN(b))}. | ||
| 1105 | * The values {@code -0.0} and {@code +0.0} are considered to be | ||
| 1106 | * equal, unlike {@link Float#equals(Object)}. | ||
| 1107 | |||
| 1108 | * </p></li> | ||
| 1109 | * | ||
| 1110 | * </ol> | ||
| 1111 | * | ||
| 1112 | * <p> A float buffer is not equal to any other type of object. </p> | ||
| 1113 | * | ||
| 1114 | * @param ob The object to which this buffer is to be compared | ||
| 1115 | * | ||
| 1116 | * @return <tt>true</tt> if, and only if, this buffer is equal to the | ||
| 1117 | * given object | ||
| 1118 | */ | ||
| 1119 | public boolean equals(Object ob) { | ||
| 1120 | if (this == ob) | ||
| 1121 | return true; | ||
| 1122 | if (!(ob instanceof FloatBuffer)) | ||
| 1123 | return false; | ||
| 1124 | FloatBuffer that = (FloatBuffer)ob; | ||
| 1125 | if (this.remaining() != that.remaining()) | ||
| 1126 | return false; | ||
| 1127 | int p = this.position(); | ||
| 1128 | for (int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j--) | ||
| 1129 | if (!equals(this.get(i), that.get(j))) | ||
| 1130 | return false; | ||
| 1131 | return true; | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | private static boolean equals(float x, float y) { | ||
| 1135 | |||
| 1136 | return (x == y) || (Float.isNaN(x) && Float.isNaN(y)); | ||
| 1137 | |||
| 1138 | |||
| 1139 | |||
| 1140 | } | ||
| 1141 | |||
| 1142 | /** | ||
| 1143 | * Compares this buffer to another. | ||
| 1144 | * | ||
| 1145 | * <p> Two float buffers are compared by comparing their sequences of | ||
| 1146 | * remaining elements lexicographically, without regard to the starting | ||
| 1147 | * position of each sequence within its corresponding buffer. | ||
| 1148 | |||
| 1149 | * Pairs of {@code float} elements are compared as if by invoking | ||
| 1150 | * {@link Float#compare(float,float)}, except that | ||
| 1151 | * {@code -0.0} and {@code 0.0} are considered to be equal. | ||
| 1152 | * {@code Float.NaN} is considered by this method to be equal | ||
| 1153 | * to itself and greater than all other {@code float} values | ||
| 1154 | * (including {@code Float.POSITIVE_INFINITY}). | ||
| 1155 | |||
| 1156 | |||
| 1157 | |||
| 1158 | |||
| 1159 | * | ||
| 1160 | * <p> A float buffer is not comparable to any other type of object. | ||
| 1161 | * | ||
| 1162 | * @return A negative integer, zero, or a positive integer as this buffer | ||
| 1163 | * is less than, equal to, or greater than the given buffer | ||
| 1164 | */ | ||
| 1165 | public int compareTo(FloatBuffer that) { | ||
| 1166 | int n = this.position() + Math.min(this.remaining(), that.remaining()); | ||
| 1167 | for (int i = this.position(), j = that.position(); i < n; i++, j++) { | ||
| 1168 | int cmp = compare(this.get(i), that.get(j)); | ||
| 1169 | if (cmp != 0) | ||
| 1170 | return cmp; | ||
| 1171 | } | ||
| 1172 | return this.remaining() - that.remaining(); | ||
| 1173 | } | ||
| 1174 | |||
| 1175 | private static int compare(float x, float y) { | ||
| 1176 | |||
| 1177 | return ((x < y) ? -1 : | ||
| 1178 | (x > y) ? +1 : | ||
| 1179 | (x == y) ? 0 : | ||
| 1180 | Float.isNaN(x) ? (Float.isNaN(y) ? 0 : +1) : -1); | ||
| 1181 | |||
| 1182 | |||
| 1183 | |||
| 1184 | } | ||
| 1185 | |||
| 1186 | // -- Other char stuff -- | ||
| 1187 | |||
| 1188 | |||
| 1189 | |||
| 1190 | |||
| 1191 | |||
| 1192 | |||
| 1193 | |||
| 1194 | |||
| 1195 | |||
| 1196 | |||
| 1197 | |||
| 1198 | |||
| 1199 | |||
| 1200 | |||
| 1201 | |||
| 1202 | |||
| 1203 | |||
| 1204 | |||
| 1205 | |||
| 1206 | |||
| 1207 | |||
| 1208 | |||
| 1209 | |||
| 1210 | |||
| 1211 | |||
| 1212 | |||
| 1213 | |||
| 1214 | |||
| 1215 | |||
| 1216 | |||
| 1217 | |||
| 1218 | |||
| 1219 | |||
| 1220 | |||
| 1221 | |||
| 1222 | |||
| 1223 | |||
| 1224 | |||
| 1225 | |||
| 1226 | |||
| 1227 | |||
| 1228 | |||
| 1229 | |||
| 1230 | |||
| 1231 | |||
| 1232 | |||
| 1233 | |||
| 1234 | |||
| 1235 | |||
| 1236 | |||
| 1237 | |||
| 1238 | |||
| 1239 | |||
| 1240 | |||
| 1241 | |||
| 1242 | |||
| 1243 | |||
| 1244 | |||
| 1245 | |||
| 1246 | |||
| 1247 | |||
| 1248 | |||
| 1249 | |||
| 1250 | |||
| 1251 | |||
| 1252 | |||
| 1253 | |||
| 1254 | |||
| 1255 | |||
| 1256 | |||
| 1257 | |||
| 1258 | |||
| 1259 | |||
| 1260 | |||
| 1261 | |||
| 1262 | |||
| 1263 | |||
| 1264 | |||
| 1265 | |||
| 1266 | |||
| 1267 | |||
| 1268 | |||
| 1269 | |||
| 1270 | |||
| 1271 | |||
| 1272 | |||
| 1273 | |||
| 1274 | |||
| 1275 | |||
| 1276 | |||
| 1277 | |||
| 1278 | |||
| 1279 | |||
| 1280 | |||
| 1281 | |||
| 1282 | |||
| 1283 | |||
| 1284 | |||
| 1285 | |||
| 1286 | |||
| 1287 | |||
| 1288 | |||
| 1289 | |||
| 1290 | |||
| 1291 | |||
| 1292 | |||
| 1293 | |||
| 1294 | |||
| 1295 | |||
| 1296 | |||
| 1297 | |||
| 1298 | |||
| 1299 | |||
| 1300 | |||
| 1301 | |||
| 1302 | |||
| 1303 | |||
| 1304 | |||
| 1305 | |||
| 1306 | |||
| 1307 | |||
| 1308 | |||
| 1309 | |||
| 1310 | |||
| 1311 | |||
| 1312 | |||
| 1313 | |||
| 1314 | |||
| 1315 | |||
| 1316 | |||
| 1317 | |||
| 1318 | |||
| 1319 | |||
| 1320 | |||
| 1321 | |||
| 1322 | |||
| 1323 | |||
| 1324 | |||
| 1325 | |||
| 1326 | |||
| 1327 | |||
| 1328 | |||
| 1329 | |||
| 1330 | |||
| 1331 | |||
| 1332 | |||
| 1333 | |||
| 1334 | |||
| 1335 | |||
| 1336 | |||
| 1337 | |||
| 1338 | |||
| 1339 | |||
| 1340 | |||
| 1341 | |||
| 1342 | |||
| 1343 | |||
| 1344 | |||
| 1345 | |||
| 1346 | |||
| 1347 | |||
| 1348 | |||
| 1349 | |||
| 1350 | |||
| 1351 | |||
| 1352 | |||
| 1353 | |||
| 1354 | |||
| 1355 | |||
| 1356 | |||
| 1357 | |||
| 1358 | |||
| 1359 | |||
| 1360 | |||
| 1361 | |||
| 1362 | |||
| 1363 | |||
| 1364 | |||
| 1365 | |||
| 1366 | |||
| 1367 | |||
| 1368 | |||
| 1369 | |||
| 1370 | |||
| 1371 | |||
| 1372 | |||
| 1373 | |||
| 1374 | |||
| 1375 | |||
| 1376 | |||
| 1377 | |||
| 1378 | |||
| 1379 | |||
| 1380 | |||
| 1381 | // -- Other byte stuff: Access to binary data -- | ||
| 1382 | |||
| 1383 | |||
| 1384 | |||
| 1385 | /** | ||
| 1386 | * Retrieves this buffer's byte order. | ||
| 1387 | * | ||
| 1388 | * <p> The byte order of a float buffer created by allocation or by | ||
| 1389 | * wrapping an existing <tt>float</tt> array is the {@link | ||
| 1390 | * ByteOrder#nativeOrder </code>native order<code>} of the underlying | ||
| 1391 | * hardware. The byte order of a float buffer created as a <a | ||
| 1392 | * href="ByteBuffer.html#views">view</a> of a byte buffer is that of the | ||
| 1393 | * byte buffer at the moment that the view is created. </p> | ||
| 1394 | * | ||
| 1395 | * @return This buffer's byte order | ||
| 1396 | */ | ||
| 1397 | public abstract ByteOrder order(); | ||
| 1398 | |||
| 1399 | |||
| 1400 | |||
| 1401 | |||
| 1402 | |||
| 1403 | |||
| 1404 | |||
| 1405 | |||
| 1406 | |||
| 1407 | |||
| 1408 | |||
| 1409 | |||
| 1410 | |||
| 1411 | |||
| 1412 | |||
| 1413 | |||
| 1414 | |||
| 1415 | |||
| 1416 | |||
| 1417 | |||
| 1418 | |||
| 1419 | |||
| 1420 | |||
| 1421 | |||
| 1422 | |||
| 1423 | |||
| 1424 | |||
| 1425 | |||
| 1426 | |||
| 1427 | |||
| 1428 | |||
| 1429 | |||
| 1430 | |||
| 1431 | |||
| 1432 | |||
| 1433 | |||
| 1434 | |||
| 1435 | |||
| 1436 | |||
| 1437 | |||
| 1438 | |||
| 1439 | |||
| 1440 | |||
| 1441 | |||
| 1442 | |||
| 1443 | |||
| 1444 | |||
| 1445 | |||
| 1446 | |||
| 1447 | |||
| 1448 | |||
| 1449 | |||
| 1450 | |||
| 1451 | } | ||