我正在尝试将一个Int8Array传递给一个数组缓冲区,它通过DWR传递给一个java方法,它接受它作为byte []参数。
Javascript:
uploadFiles: function(eve) {
var fileContent = null;
for(var i = 0; i < this.filesToBeUploaded.length; i++){
var reader = new FileReader();
reader.onload = (function(fileToBeUploaded) {
return function(e) {
file = e.target.result;
var view = new Int8Array(file);
// fileContent object contains the content of the read file
};
})(this.filesToBeUploaded[i]);
reader.readAsArrayBuffer(this.filesToBeUploaded[i]);
}
}
我希望将视图的内容传递给此方法 -
public boolean uploadFile(String fileName, byte[] fileContent) {}
DWR似乎无法将视图对象封送到java层。我有什么设置吗?