CharBuffer Class

Definition

A char buffer.

[Android.Runtime.Register("java/nio/CharBuffer", DoNotGenerateAcw=true)]
public abstract class CharBuffer : Java.Nio.Buffer, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IAppendable, Java.Lang.ICharSequence, Java.Lang.IComparable, Java.Lang.IReadable, System.Collections.Generic.IEnumerable<char>
[<Android.Runtime.Register("java/nio/CharBuffer", DoNotGenerateAcw=true)>]
type CharBuffer = class
    inherit Buffer
    interface IAppendable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface ICharSequence
    interface seq<char>
    interface IEnumerable
    interface IComparable
    interface IReadable
Inheritance
CharBuffer
Attributes
Implements

Remarks

A char buffer.

This class defines four categories of operations upon char buffers:

<ul>

<li>

Absolute and relative #get() <i>get</i> and #put(char) <i>put</i> methods that read and write single chars;

</li>

<li>

Relative #get(char[]) <i>bulk get</i> methods that transfer contiguous sequences of chars from this buffer into an array; and

</li>

<li>

Relative #put(char[]) <i>bulk put</i> methods that transfer contiguous sequences of chars from a char array,&#32;a&#32;string, or some other char buffer into this buffer;&#32;and

</li>

<li>

Methods for #compact compacting, #duplicate duplicating, and #slice slicing a char buffer.

</li>

</ul>

Char buffers can be created either by #allocate <i>allocation</i>, which allocates space for the buffer's

content, by #wrap(char[]) <i>wrapping</i> an existing char array or&#32;string into a buffer, or by creating a <i>view</i> of an existing byte buffer.

Like a byte buffer, a char buffer is either <i>direct</i> or <i>non-direct</i>. A char buffer created via the wrap methods of this class will be non-direct. A char buffer created as a view of a byte buffer will be direct if, and only if, the byte buffer itself is direct. Whether or not a char buffer is direct may be determined by invoking the #isDirect isDirect method.

This class implements the CharSequence interface so that character buffers may be used wherever character sequences are accepted, for example in the regular-expression package java.util.regex.

Methods in this class that do not otherwise have a value to return are specified to return the buffer upon which they are invoked. This allows method invocations to be chained.

The sequence of statements

<blockquote>

cb.put("text/");
            cb.put(subtype);
            cb.put("; charset=");
            cb.put(enc);

</blockquote>

can, for example, be replaced by the single statement

<blockquote>

cb.put("text/").put(subtype).put("; charset=").put(enc);

</blockquote>

Added in 1.4.

Java documentation for java.nio.CharBuffer.

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.

Constructors

CharBuffer(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasArray

Tells whether or not this buffer is backed by an accessible char array.

HasRemaining

Tells whether there are any elements between the current position and the limit.

(Inherited from Buffer)
IsDirect

Returns true if this is a direct buffer.

(Inherited from Buffer)
IsEmpty

Returns true if this character buffer is empty.

IsReadOnly

Indicates whether this buffer is read-only.

(Inherited from Buffer)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Allocate(Int32)

Allocates a new char buffer.

Append(Char)

Appends the specified char to this buffer&nbsp;&nbsp;(optional operation).

Append(ICharSequence, Int32, Int32)

Appends a subsequence of the specified character sequence to this buffer&nbsp;&nbsp;(optional operation).

Append(ICharSequence)

Appends the specified character sequence to this buffer&nbsp;&nbsp;(optional operation).

Append(String, Int32, Int32)

Appends a subsequence of the specified character sequence to this buffer&nbsp;&nbsp;(optional operation).

Append(String)

Appends the specified character sequence to this buffer&nbsp;&nbsp;(optional operation).

ArrayOffset()

Returns the offset within this buffer's backing array of the first element of the buffer&nbsp;&nbsp;(optional operation).

AsReadOnlyBuffer()

Creates a new, read-only char buffer that shares this buffer's content.

Capacity()

Returns this buffer's capacity.

(Inherited from Buffer)
CharAt(Int32)

Reads the character at the given index relative to the current position.

Clear()

Clears this buffer.

(Inherited from Buffer)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Compact()

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

CompareTo(CharBuffer)

Compares this buffer to another.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Duplicate()

Creates a new char buffer that shares this buffer's content.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Flip()

Flips this buffer.

(Inherited from Buffer)
Get()

Relative get method.

Get(Char[], Int32, Int32)

Relative bulk get method.

Get(Char[])

Relative bulk get method.

Get(Int32)

Absolute get method.

GetDirectBufferAddress() (Inherited from Buffer)
GetEnumerator()
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Length()

Returns the length of this character buffer.

Limit()

Returns this buffer's limit.

(Inherited from Buffer)
Limit(Int32)

Sets this buffer's limit.

(Inherited from Buffer)
Mark()

Sets this buffer's mark at its position.

(Inherited from Buffer)
Mismatch(CharBuffer)

Finds and returns the relative index of the first mismatch between this buffer and a given buffer.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Order()

Retrieves this buffer's byte order.

Position()

Returns this buffer's position.

(Inherited from Buffer)
Position(Int32)

Sets this buffer's position.

(Inherited from Buffer)
Put(Char)

Relative put method&nbsp;&nbsp;(optional operation).

Put(Char[], Int32, Int32)

Relative bulk put method&nbsp;&nbsp;(optional operation).

Put(Char[])

Relative bulk put method&nbsp;&nbsp;(optional operation).

Put(CharBuffer)

Relative bulk put method&nbsp;&nbsp;(optional operation).

Put(Int32, Char)

Absolute put method&nbsp;&nbsp;(optional operation).

Put(String, Int32, Int32)

Relative bulk put method&nbsp;&nbsp;(optional operation).

Put(String)

Relative bulk put method&nbsp;&nbsp;(optional operation).

Read(CharBuffer)

Attempts to read characters into the specified character buffer.

Remaining()

Returns the number of elements between the current position and the limit.

(Inherited from Buffer)
Reset()

Resets this buffer's position to the previously-marked position.

(Inherited from Buffer)
Rewind()

Rewinds this buffer.

(Inherited from Buffer)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Slice()

Creates a new char buffer whose content is a shared subsequence of this buffer's content.

Slice(Int32, Int32)

Creates a new char buffer whose content is a shared subsequence of this buffer's content.

Slice(Int32, Int32)

Creates a new buffer whose content is a shared subsequence of this buffer's content.

(Inherited from Buffer)
SubSequence(Int32, Int32)

Creates a new character buffer that represents the specified subsequence of this buffer, relative to the current position.

SubSequenceFormatted(Int32, Int32)

Creates a new character buffer that represents the specified subsequence of this buffer, relative to the current position.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wrap(Char[], Int32, Int32)

Wraps a char array into a buffer.

Wrap(Char[])

Wraps a char array into a buffer.

Wrap(ICharSequence, Int32, Int32)

Wraps a character sequence into a buffer.

Wrap(ICharSequence)

Wraps a character sequence into a buffer.

Wrap(String, Int32, Int32)

Wraps a character sequence into a buffer.

Wrap(String)

Wraps a character sequence into a buffer.

Explicit Interface Implementations

IAppendable.Append(Char)
IAppendable.Append(ICharSequence, Int32, Int32)
IAppendable.Append(ICharSequence)
IComparable.CompareTo(Object)
IEnumerable.GetEnumerator()
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)
Append(IAppendable, String, Int32, Int32)
Append(IAppendable, String)
SubSequence(ICharSequence, Int32, Int32)

Applies to