jdk/src/share/classes/java/nio/Buffer.java
changeset 18574 4aeaeb541678
parent 18164 68f1bc4eadd4
child 23010 6dadb192ad81
equal deleted inserted replaced
18573:52f07c119829 18574:4aeaeb541678
    50  * </blockquote>
    50  * </blockquote>
    51  *
    51  *
    52  * <p> There is one subclass of this class for each non-boolean primitive type.
    52  * <p> There is one subclass of this class for each non-boolean primitive type.
    53  *
    53  *
    54  *
    54  *
    55  * <h4> Transferring data </h4>
    55  * <h2> Transferring data </h2>
    56  *
    56  *
    57  * <p> Each subclass of this class defines two categories of <i>get</i> and
    57  * <p> Each subclass of this class defines two categories of <i>get</i> and
    58  * <i>put</i> operations: </p>
    58  * <i>put</i> operations: </p>
    59  *
    59  *
    60  * <blockquote>
    60  * <blockquote>
    76  * <p> Data may also, of course, be transferred in to or out of a buffer by the
    76  * <p> Data may also, of course, be transferred in to or out of a buffer by the
    77  * I/O operations of an appropriate channel, which are always relative to the
    77  * I/O operations of an appropriate channel, which are always relative to the
    78  * current position.
    78  * current position.
    79  *
    79  *
    80  *
    80  *
    81  * <h4> Marking and resetting </h4>
    81  * <h2> Marking and resetting </h2>
    82  *
    82  *
    83  * <p> A buffer's <i>mark</i> is the index to which its position will be reset
    83  * <p> A buffer's <i>mark</i> is the index to which its position will be reset
    84  * when the {@link #reset reset} method is invoked.  The mark is not always
    84  * when the {@link #reset reset} method is invoked.  The mark is not always
    85  * defined, but when it is defined it is never negative and is never greater
    85  * defined, but when it is defined it is never negative and is never greater
    86  * than the position.  If the mark is defined then it is discarded when the
    86  * than the position.  If the mark is defined then it is discarded when the
    87  * position or the limit is adjusted to a value smaller than the mark.  If the
    87  * position or the limit is adjusted to a value smaller than the mark.  If the
    88  * mark is not defined then invoking the {@link #reset reset} method causes an
    88  * mark is not defined then invoking the {@link #reset reset} method causes an
    89  * {@link InvalidMarkException} to be thrown.
    89  * {@link InvalidMarkException} to be thrown.
    90  *
    90  *
    91  *
    91  *
    92  * <h4> Invariants </h4>
    92  * <h2> Invariants </h2>
    93  *
    93  *
    94  * <p> The following invariant holds for the mark, position, limit, and
    94  * <p> The following invariant holds for the mark, position, limit, and
    95  * capacity values:
    95  * capacity values:
    96  *
    96  *
    97  * <blockquote>
    97  * <blockquote>
   107  * that depends upon the type of the buffer and the manner in which it is
   107  * that depends upon the type of the buffer and the manner in which it is
   108  * constructed.  Each element of a newly-allocated buffer is initialized
   108  * constructed.  Each element of a newly-allocated buffer is initialized
   109  * to zero.
   109  * to zero.
   110  *
   110  *
   111  *
   111  *
   112  * <h4> Clearing, flipping, and rewinding </h4>
   112  * <h2> Clearing, flipping, and rewinding </h2>
   113  *
   113  *
   114  * <p> In addition to methods for accessing the position, limit, and capacity
   114  * <p> In addition to methods for accessing the position, limit, and capacity
   115  * values and for marking and resetting, this class also defines the following
   115  * values and for marking and resetting, this class also defines the following
   116  * operations upon buffers:
   116  * operations upon buffers:
   117  *
   117  *
   130  *   to zero.  </p></li>
   130  *   to zero.  </p></li>
   131  *
   131  *
   132  * </ul>
   132  * </ul>
   133  *
   133  *
   134  *
   134  *
   135  * <h4> Read-only buffers </h4>
   135  * <h2> Read-only buffers </h2>
   136  *
   136  *
   137  * <p> Every buffer is readable, but not every buffer is writable.  The
   137  * <p> Every buffer is readable, but not every buffer is writable.  The
   138  * mutation methods of each buffer class are specified as <i>optional
   138  * mutation methods of each buffer class are specified as <i>optional
   139  * operations</i> that will throw a {@link ReadOnlyBufferException} when
   139  * operations</i> that will throw a {@link ReadOnlyBufferException} when
   140  * invoked upon a read-only buffer.  A read-only buffer does not allow its
   140  * invoked upon a read-only buffer.  A read-only buffer does not allow its
   141  * content to be changed, but its mark, position, and limit values are mutable.
   141  * content to be changed, but its mark, position, and limit values are mutable.
   142  * Whether or not a buffer is read-only may be determined by invoking its
   142  * Whether or not a buffer is read-only may be determined by invoking its
   143  * {@link #isReadOnly isReadOnly} method.
   143  * {@link #isReadOnly isReadOnly} method.
   144  *
   144  *
   145  *
   145  *
   146  * <h4> Thread safety </h4>
   146  * <h2> Thread safety </h2>
   147  *
   147  *
   148  * <p> Buffers are not safe for use by multiple concurrent threads.  If a
   148  * <p> Buffers are not safe for use by multiple concurrent threads.  If a
   149  * buffer is to be used by more than one thread then access to the buffer
   149  * buffer is to be used by more than one thread then access to the buffer
   150  * should be controlled by appropriate synchronization.
   150  * should be controlled by appropriate synchronization.
   151  *
   151  *
   152  *
   152  *
   153  * <h4> Invocation chaining </h4>
   153  * <h2> Invocation chaining </h2>
   154  *
   154  *
   155  * <p> Methods in this class that do not otherwise have a value to return are
   155  * <p> Methods in this class that do not otherwise have a value to return are
   156  * specified to return the buffer upon which they are invoked.  This allows
   156  * specified to return the buffer upon which they are invoked.  This allows
   157  * method invocations to be chained; for example, the sequence of statements
   157  * method invocations to be chained; for example, the sequence of statements
   158  *
   158  *