次の方法で共有


IntBuffer.Compact Method

Definition

Compacts this buffer  (optional operation).

[Android.Runtime.Register("compact", "()Ljava/nio/IntBuffer;", "GetCompactHandler")]
public abstract Java.Nio.IntBuffer? Compact ();
[<Android.Runtime.Register("compact", "()Ljava/nio/IntBuffer;", "GetCompactHandler")>]
abstract member Compact : unit -> Java.Nio.IntBuffer

Returns

This buffer

Attributes

Exceptions

if no changes may be made to the contents of this buffer.

Remarks

Compacts this buffer&nbsp;&nbsp;(optional operation).

The ints between the buffer's current position and its limit, if any, are copied to the beginning of the buffer. That is, the int at index p&nbsp;=&nbsp;position() is copied to index zero, the int at index p&nbsp;+&nbsp;1 is copied to index one, and so forth until the int at index limit()&nbsp;-&nbsp;1 is copied to index n&nbsp;=&nbsp;limit()&nbsp;-&nbsp;1&nbsp;-&nbsp;p. The buffer's position is then set to n+1 and its limit is set to its capacity. The mark, if defined, is discarded.

The buffer's position is set to the number of ints copied, rather than to zero, so that an invocation of this method can be followed immediately by an invocation of another relative put method.

Java documentation for java.nio.IntBuffer.compact().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to