From beb9e5c684b1ebbda3ff0bf3bf672b9cd6f5362a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 28 Feb 2014 10:03:01 -0800 Subject: [PATCH] Refactor InputStream API. --- .../src/main/webapp/modules/Client.js | 66 +++--- .../src/main/webapp/modules/InputStream.js | 195 ++++++++++++++++-- .../src/main/webapp/scripts/client-ui.js | 6 +- 3 files changed, 220 insertions(+), 47 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/Client.js b/guacamole-common-js/src/main/webapp/modules/Client.js index b000045d4..cd79fdc9a 100644 --- a/guacamole-common-js/src/main/webapp/modules/Client.js +++ b/guacamole-common-js/src/main/webapp/modules/Client.js @@ -438,9 +438,10 @@ Guacamole.Client = function(tunnel) { * close event. * * @event + * @param {String} mimetype The mimetype of the file received. * @param {String} filename The name of the file received. - * @param {Guacamole.InputStream} stream A stream that will receive - * data from the server. + * @return {Guacamole.InputStream} The stream that will receive data from + * the server. */ this.onfile = null; @@ -450,9 +451,10 @@ Guacamole.Client = function(tunnel) { * close event. * * @event + * @param {String} mimetype The mimetype of the data which will be received. * @param {String} name The name of the pipe. - * @param {Guacamole.InputStream} stream A stream that will receive - * data from the server. + * @return {Guacamole.InputStream} The stream that will receive data from + * the server. */ this.onpipe = null; @@ -637,16 +639,8 @@ Guacamole.Client = function(tunnel) { var data = parameters[1]; var stream = streams[stream_index]; - // Convert to ArrayBuffer - var binary = window.atob(data); - var arrayBuffer = new ArrayBuffer(binary.length); - var bufferView = new Uint8Array(arrayBuffer); - - for (var i=0; i