Outofmemoryerror ByteArrayOutputStream sending large file to WS
问题 im sending videos to webservice and works ok with videos less than 10MB, if the video is about 12MB give me outofmemoryerror: This is my code: FileInputStream fileInputStream = new FileInputStream(fichero); int bytesAvailable = fileInputStream.available(); int maxBufferSize = 1024 * 1024 * 2; int bufferSize = Math.min(bytesAvailable, maxBufferSize); byte[] buffer = new byte[bufferSize]; int bytesRead = fileInputStream.read(buffer, 0, bufferSize); while (bytesRead > 0) { dos.write(buffer, 0,