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
Post a Comment