Thursday, 17 March 2016

Important Links

Links to refer:

File DownoadJava code geeks

Zip/Unzip File : mkyong

Html creation from URLmkyong

Creating a directorymkyong stack over flow

Upload filejava

Excel creation blog

Spring Web service Blogger brian's


InputStream fis = new FileInputStream(filenameInServer_fileObject);
res.setContentType("application/octet-stream");
res.setContentLength((int) fileObject.length());
res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
       ServletOutputStream os = res.getOutputStream();
       byte[] bufferData = new byte[1024];
       int read=0;
       while((read = fis.read(bufferData))!= -1){
           os.write(bufferData, 0, read);
       }
       os.flush();
       os.close();
       fis.close();


Thanks,
Amar

No comments:

Post a Comment