I assume that you want to allow the user to download the file using the GWT Fileupload widget, and then you do not want to process it on the server side. You need a byte array representation on the client side.
The usual steps for processing files are Browser → File upload dialog → Select file → Send form with file to server → Process file on server → Send processed file to client as response (line).
If you want to avoid the steps described above and process the file in a browser, there is no way to do this in the current javascript. Parallel technologies such as Flash, Applet, Silverlight, or Activex can help. The correct approach in the future will be to use an HTML5 apis file .
If you do not want to use outdated technologies such as flash / applet, then you can learn HTML5 apis on FileReader. However, the tradeoff is that you need to check if api is supported in the browser.
HTML5 FileReader
FileReader includes four options for reading a file, asynchronously:
FileReader.readAsBinaryString(Blob|File) - The result property will contain the file/blob data as a binary string. FileReader.readAsText(Blob|File, opt_encoding) - The result property will contain the file/blob data as a text string. FileReader.readAsDataURL(Blob|File) - The result property will contain the file/blob data encoded as a data URL. FileReader.readAsArrayBuffer(Blob|File) - The result property will contain the file/blob data as an ArrayBuffer object.
An example of a GWT wrapper over them - https://github.com/bradrydzewski/gwt-filesystem
Link -
SSR
source share