java - Jersey 1.17 download large files -


i want download large files rest service, have code:

@get @path("/labodownloadanytype") @produces(mediatype.application_octet_stream) public response labodownload() throws filenotfoundexception {     final string filename = "samplevideo_1280x720_50mb.mp4";     final inputstream fileinstream = new fileinputstream(filename);     return response.ok(fileinstream, mediatype.application_octet_stream_type)       .header("content-disposition", "attachment; filename=\"" + filename + "\"" ) //optional       .build(); } 

and when i'm using small files works great, want download large file (from 500mb 3gb) i'm getting

java.lang.outofmemoryerror: java heap space 

how solve problem?

use mappedbytebuffer instead of inputstream , can check implementation of mappedbytebuffer here check link

hope provide functionality need.


Comments

Popular posts from this blog

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

testing - Detect whether test has failed within fixture -

android - Create single AAR file from multiple modules using Gradle -