Share via


CharsetDecoder.DetectedCharset Method

Definition

Retrieves the charset that was detected by this decoder  (optional operation).

[Android.Runtime.Register("detectedCharset", "()Ljava/nio/charset/Charset;", "GetDetectedCharsetHandler")]
public virtual Java.Nio.Charset.Charset? DetectedCharset ();
[<Android.Runtime.Register("detectedCharset", "()Ljava/nio/charset/Charset;", "GetDetectedCharsetHandler")>]
abstract member DetectedCharset : unit -> Java.Nio.Charset.Charset
override this.DetectedCharset : unit -> Java.Nio.Charset.Charset

Returns

The charset detected by this auto-detecting decoder, or null if the charset has not yet been determined

Attributes

Exceptions

if this decoder does not implement an auto-detecting charset.

if insufficient bytes have been read to determine the charset.

Remarks

Retrieves the charset that was detected by this decoder&nbsp;&nbsp;(optional operation).

If this decoder implements an auto-detecting charset then this method returns the actual charset once it has been detected. After that point, this method returns the same value for the duration of the current decoding operation. If not enough input bytes have yet been read to determine the actual charset then this method throws an IllegalStateException.

The default implementation of this method always throws an UnsupportedOperationException; it should be overridden by auto-detecting decoders to return the appropriate value.

Java documentation for java.nio.charset.CharsetDecoder.detectedCharset().

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