ServerJS/Encodings: Difference between revisions

→‎Alternative: Converter: add a second example
(→‎Alternative: Converter: add outputByteArray parameter for further efficiency)
(→‎Alternative: Converter: add a second example)
Line 87: Line 87:
   converter = new Converter('iso-8859-1', 'utf-32')
   converter = new Converter('iso-8859-1', 'utf-32')
   output = converter.push(input) // input is a ByteString, and output too
   output = converter.push(input) // input is a ByteString, and output too
  converter.close()
Another example:
  converter = new Converter('utf-32', 'utf-8')
  output = new ByteArray()
  while (input = readSomeByteFromSomewhere()) {
          converter.push(input, output)
  }
   converter.close()
   converter.close()
62

edits