Object built-in object

Object StringDecoder

Stream decoding object

inheritance relationship

Constructor

StringDecoder

Decoder constructor

1
new StringDecoder(String encoding = "utf8");

Call parameters:

  • encoding: String, decoding encoding. Default is 'utf8'.

member properties

lastNeed

Integer, used internally.

1
Integer StringDecoder.lastNeed;

lastTotal

Integer, used internally.

1
Integer StringDecoder.lastTotal;

lastChar

Buffer, internal use.

1
Buffer StringDecoder.lastChar;

encoding

String, decoding encoding. Internal use.

1
String StringDecoder.encoding;

member function

end

Return the internally stored buffer as characters. Incomplete UTF-8 and UTF-16 bytes are attempted to be completed.

1
String StringDecoder.end();

Return results:

  • String, the decoded string.

Return the internally stored buffer as characters. Incomplete UTF-8 and UTF-16 bytes are attempted to be completed.

1
String StringDecoder.end(Buffer buf);

Call parameters:

  • buf:Buffer, need to be decodedBuffer. Before executing end, write will be called to write the buffer.

Return results:

  • String, the decoded string.

write

Returns a decoded string, ensuring that any incomplete trailing characters are omitted and are not returned this time, but are stored internally for use by the next write or end method.

1
String StringDecoder.write(Buffer buf);

Call parameters:

Return results:

  • String, the decoded string.

text

internal use. .

1 2
String StringDecoder.text(Buffer buf, Integer offset);

Call parameters:

  • buf:Buffer, need to be decodedBuffer.
  • offset: Integer, decoding offset

Return results:

  • String, the decoded string.

fillLast

internal use. .

1
String StringDecoder.fillLast(Buffer buf);

Call parameters:

Return results:

  • String, the decoded string.

toString

Returns the string representation of the object. Generally, "[Native Object]" is returned. The object can be re-implemented according to its own characteristics.

1
String StringDecoder.toString();

Return results:

  • String, returns the string representation of the object

toJSON

Returns a JSON format representation of the object, generally returning a collection of readable properties defined by the object.

1
Value StringDecoder.toJSON(String key = "");

Call parameters:

  • key: String, not used

Return results:

  • Value, returns a value containing JSON serializable