Object built-in object

Object StringDecoder

Stream decoding object

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<this>StringDecoder|new StringDecoder()|lastNeed;lastTotal;lastChar;encoding|end();write();text();fillLast()] [object] <:- [StringDecoder] StringDecoder new StringDecoder() lastNeed lastTotal lastChar encoding end() write() text() fillLast() object toString() toJSON()

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, internal use.

1
Buffer StringDecoder.lastChar;

encoding

String, decoding and encoding. Used internally.

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, Need to be decoded Buffer. Before executing end, it will call write to write the buffer.

Return result:

  • String, The decoded string.

write

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

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