ServerJS/Encodings: Difference between revisions

Jump to navigation Jump to search
→‎Alternative: Converter: add outputByteArray parameter for further efficiency
m (→‎Alternative: Converter: explain that it is probably faster)
(→‎Alternative: Converter: add outputByteArray parameter for further efficiency)
Line 75: Line 75:
; [Constructor] Converter(from, to)
; [Constructor] Converter(from, to)
: Where from and to are the encoding names.
: Where from and to are the encoding names.
; [Method] push(byteStringOrArray)
; [Method] push(byteStringOrArray[, outputByteArray])
: Convert input from a ByteString or ByteArray. The results are returned, and those parts of byteStringOrArray that could not be converted (for multi-byte encodings) are stored in a buffer.
: Convert input from a ByteString or ByteArray. Those parts of byteStringOrArray that could not be converted (for multi-byte encodings) are stored in a buffer. If outputByteArray is passed, the results are ''appended'' to outputByteArray.
: Returns (as a ByteString) as much as could be converted.
: If outputByteArray was passed, returns outputByteArray, otherwise returns (as a ByteString) as much output as could be converted.
; [Method] close()
; [Method] close()
: Close the stream. Throws an exception if there was a conversion error (specifically, a partial multibyte character).
: Close the stream. Throws an exception if there was a conversion error (specifically, a partial multibyte character).
62

edits

Navigation menu