Object built-in object

Object StringDecoder

Stream decoding object

Inheritance

Constructor

StringDecoder

Decoder constructor

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

Call parameters:

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

Member attributes

lastNeed

Integer, used internally.

1
Integer StringDecoder.lastNeed;

lastTotal

Integer, used internally.

1
Integer StringDecoder.lastTotal;

lastChar

Buffer , used internally.

1
Buffer StringDecoder.lastChar;

encoding

String, decoding encoding. Internal use.

1
String StringDecoder.encoding;

Member function

end

Return the internal buffer as a character. Incomplete UTF-8 and UTF-16 bytes will try to complete.

1
String StringDecoder.end();

Return result:

  • String , the decoded string.

Return the internal buffer as a character. Incomplete UTF-8 and UTF-16 bytes will try to complete.

1
String StringDecoder.end(Buffer buf);

Call parameters:

  • buf : Buffer , needs to be decoded Buffer . Before performing the end, will first call will write buffer is written.

Return result:

  • String , the decoded string.

write

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

1
String StringDecoder.write(Buffer buf);

Call parameters:

Return result:

  • String , the decoded string.

text

internal use. .

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

Call parameters:

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

Return result:

  • String , the decoded string.

fillLast

internal use. .

1
String StringDecoder.fillLast(Buffer buf);

Call parameters:

Return result:

  • String , the decoded string.

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String StringDecoder.toString();

Return result:

  • String , returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

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

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable