Scoop API

scoop:scoop.charset:0.1.0

CharsetTranscoder

class CharsetTranscoder

source · line 12
public
public class CharsetTranscoder public constructor(
    /**
     * The encoding of bytes read from the input buffer.
     */
    public val source: Charset,
        /**
         * The encoding of bytes appended to the output buffer.
         */
        public val destination: Charset,
    options: CharsetTranscodeOptions = CharsetTranscodeOptions()
) : Closeable

A stateful native converter between two encodings. Close it after use, including after a conversion failure.

Calls must not overlap. Once final input is accepted, no further nonempty input may be supplied; continue draining output until CharsetState.Finished.

function process

source · line 38
public
public fun process(input: NativeByteBuffer, output: NativeByteBuffer, endInput: Boolean = false): CharsetStep

Converts readable input into writable output and advances both buffers by the returned byte counts. Set endInput for the final input; repeat calls as requested by CharsetStep.state until finished.

@throws IllegalStateException

The converter is closed, failed, already in use, or receives input after completion.

@throws CharsetException

Conversion violates the selected text or BOM policy.

property source

source · line 16
public
public val source: Charset

get: public read-only

The encoding of bytes read from the input buffer.

property destination

source · line 20
public
public val destination: Charset

get: public read-only

The encoding of bytes appended to the output buffer.

function close

source · line 70
public
public override fun close(): Unit

Releases the native conversion state. Repeated closes are allowed, but a close must not overlap a conversion call.