Slow reading a very large string

0

I am losing a lot of performace when doing a decodeBase64 , when I have a very large file type 30MB, it takes a lot to read the data received from the front.

Is there any way to improve the reading of this file that is in fileBase64?

On the front the file looks like this:

reader.onload = function (readerEvt) {
        var anexosTemp = [];
        $scope.$apply(function () {
           var binaryString = readerEvt.target.result;
           var fileBase64 = btoa(binaryString);

           anexoVO = {
              dados: fileBase64,
              nome: vm.anexo.arquivo.name,
              descricao: vm.anexo.descricao,
              tamanho: vm.anexo.arquivo.size,
              tipo: vm.anexo.arquivo.type,
           };

           anexosTemp.push(anexoVO);
           vm.anexo = null;

        });

        var url = null;

        if ($location.host() === "localhost") {
           url = "xxxxxxxxxxxxxxxx";
        } else {
           url ="xxxxxxxxxxxxxxx";
        }

        var configHttp = {
           transformRequest: angular.identity,
           headers: {
              'Content-Type': undefined
           }
        };

        var formulario = new FormData();
        vm.solicitacao.anexos = anexosTemp;
        formulario.append("file", JSON.stringify(vm.solicitacao));

        $http.post(url, formulario, configHttp)

In Java I do this:

@Consumes(MediaType.MULTIPART_FORM_DATA)
public CSResponse adicionarArquivo(String strSolicitacao){
String[] str = strSolicitacao.split("file\"");
    String[] str2 = str[1].trim().split("------");
    String solJson = str2[0].trim();
    Gson g = new GsonBuilder().registerTypeAdapter(Date.class, new 
    GsonUTCDateAdapter()).create();
    Sol sol = g.fromJson(solJson, Sol.class);
}

Except that this process in reading my dados attribute takes a long time when it is reading. How do I improve performance on reading this gigante string coming through my js and doing that with that JSON being faster converted?

    
asked by anonymous 10.10.2018 / 17:41

0 answers