1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Module "mojo/public/js/bindings/unicode"
7 // Note: This file is for documentation purposes only. The code here is not
8 // actually executed. The real module is implemented natively in Mojo.
13 * Decodes the UTF8 string from the given buffer.
14 * @param {ArrayBufferView} buffer The buffer containing UTF8 string data.
15 * @return {string} The corresponding JavaScript string.
17 function decodeUtf8String(buffer
) { [native code
] }
20 * Encodes the given JavaScript string into UTF8.
21 * @param {string} str The string to encode.
22 * @param {ArrayBufferView} outputBuffer The buffer to contain the result.
23 * Should be pre-allocated to hold enough space. Use |utf8Length| to determine
24 * how much space is required.
25 * @return {number} The number of bytes written to |outputBuffer|.
27 function encodeUtf8String(str
, outputBuffer
) { [native code
] }
30 * Returns the number of bytes that a UTF8 encoding of the JavaScript string
33 function utf8Length(str
) { [native code
] }