0 Replies Latest reply on Jul 30, 2008 4:32 AM by Jik Tom

    java.lang.ArrayIndexOutOfBoundsException: 8192 when write a

    Jik Tom Newbie

      Hi,

      I'm trying to write a byte array to response.getOutputStream() but it throws java.lang.ArrayIndexOutOfBoundsException: 8192 .

      My code is

      byte[] excelBytes= new byte[docDTO().length];//DTO object with byte array
      System.arraycopy(docDTO.getDocument(), 0, excelBytes, 0,docDTO.getDocument().length);
      final int xlsBytesLen = excelBytes.length-1;
       response.setHeader("Content-Disposition","inline;filename=\"" + FileName + "\"");
      response.setContentLength(xlsBytesLen);
      
      // Send content to Browser
      response.getOutputStream().write(excelBytes, 0, xlsBytesLen);
      Any help would be appreciated.

      Thanks,
      Jik