CharsetDecoder Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An engine that can transform a sequence of bytes in a specific charset into a sequence of sixteen-bit Unicode characters.
[Android.Runtime.Register("java/nio/charset/CharsetDecoder", DoNotGenerateAcw=true)]
public abstract class CharsetDecoder : Java.Lang.Object
[<Android.Runtime.Register("java/nio/charset/CharsetDecoder", DoNotGenerateAcw=true)>]
type CharsetDecoder = class
inherit Object
- Inheritance
- Attributes
An engine that can transform a sequence of bytes in a specific charset into a sequence of sixteen-bit Unicode characters.
"steps">
The input byte sequence is provided in a byte buffer or a series of such buffers. The output character sequence is written to a character buffer or a series of such buffers. A decoder should always be used by making the following sequence of method invocations, hereinafter referred to as a decoding operation:
<ol>
<li>
Reset the decoder via the #reset reset
method, unless it has not been used before;
</li>
<li>
Invoke the #decode decode
method zero or more times, as long as additional input may be available, passing false
for the endOfInput
argument and filling the input buffer and flushing the output buffer between invocations;
</li>
<li>
Invoke the #decode decode
method one final time, passing true
for the endOfInput
argument; and then
</li>
<li>
Invoke the #flush flush
method so that the decoder can flush any internal state to the output buffer.
</li>
</ol>
Each invocation of the #decode decode
method will decode as many bytes as possible from the input buffer, writing the resulting characters to the output buffer. The #decode decode
method returns when more input is required, when there is not enough room in the output buffer, or when a decoding error has occurred. In each case a CoderResult
object is returned to describe the reason for termination. An invoker can examine this object and fill the input buffer, flush the output buffer, or attempt to recover from a decoding error, as appropriate, and try again.
"ce">
There are two general types of decoding errors. If the input byte sequence is not legal for this charset then the input is considered malformed. If the input byte sequence is legal but cannot be mapped to a valid Unicode character then an unmappable character has been encountered.
"cae">
How a decoding error is handled depends upon the action requested for that type of error, which is described by an instance of the CodingErrorAction
class. The possible error actions are to CodingErrorAction#IGNORE ignore the erroneous input, CodingErrorAction#REPORT report the error to the invoker via the returned CoderResult
object, or CodingErrorAction#REPLACE replace the erroneous input with the current value of the replacement string. The replacement
has the initial value "\uFFFD"
;
its value may be changed via the #replaceWith(java.lang.String) replaceWith
method.
The default action for malformed-input and unmappable-character errors is to CodingErrorAction#REPORT report them. The malformed-input error action may be changed via the #onMalformedInput(CodingErrorAction) onMalformedInput
method; the unmappable-character action may be changed via the #onUnmappableCharacter(CodingErrorAction) onUnmappableCharacter
method.
This class is designed to handle many of the details of the decoding process, including the implementation of error actions. A decoder for a specific charset, which is a concrete subclass of this class, need only implement the abstract #decodeLoop decodeLoop
method, which encapsulates the basic decoding loop. A subclass that maintains internal state should, additionally, override the #implFlush implFlush
and #implReset implReset
methods.
Instances of this class are not safe for use by multiple concurrent threads.
Added in 1.4.
Java documentation for java.nio.charset.CharsetDecoder
.
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.
Charset |
Initializes a new decoder. |
Charset |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
Is |
Tells whether or not this decoder implements an auto-detecting charset. |
Is |
Tells whether or not this decoder has yet detected a charset (optional operation). |
Jni |
(Inherited from Object) |
Jni |
|
Peer |
(Inherited from Object) |
Threshold |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Threshold |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. |
Average |
Returns the average number of characters that will be produced for each byte of input. |
Charset() |
Returns the charset that created this decoder. |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Decode(Byte |
Decodes as many bytes as possible from the given input buffer, writing the results to the given output buffer. |
Decode(Byte |
Convenience method that decodes the remaining content of a single input byte buffer into a newly-allocated character buffer. |
Decode |
Decodes one or more bytes into one or more characters. |
Detected |
Retrieves the charset that was detected by this decoder (optional operation). |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
Flush(Char |
Flushes this decoder. |
Get |
Returns a hash code value for the object. (Inherited from Object) |
Impl |
Flushes this decoder. |
Impl |
Reports a change to this decoder's malformed-input action. |
Impl |
Reports a change to this decoder's unmappable-character action. |
Impl |
Reports a change to this decoder's replacement value. |
Impl |
Resets this decoder, clearing any charset-specific internal state. |
Java |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Malformed |
Returns this decoder's current action for malformed-input errors. |
Max |
Returns the maximum number of characters that will be produced for each byte of input. |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
Notify |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
On |
Changes this decoder's action for malformed-input errors. |
On |
Changes this decoder's action for unmappable-character errors. |
Replacement() |
Returns this decoder's replacement value. |
Replace |
Changes this decoder's replacement value. |
Reset() |
Resets this decoder, clearing any internal state. |
Set |
Sets the Handle property. (Inherited from Object) |
To |
(Inherited from Object) |
To |
Returns a string representation of the object. (Inherited from Object) |
Unmappable |
Returns this decoder's current action for unmappable-character errors. |
Unregister |
(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) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
IJava |
(Inherited from Object) |
Java |
Performs an Android runtime-checked type conversion. |
Java |
|
Get |