title: Can We download Zip for multiple txt files without downloading the txt fileS in java?
body: <p>Can we write into multiple txt files and download them directly  as zip (Without downloading txt files ) </p>
  
  <p>When we write in file it is done in physical file. But when we want to create zip of that reference it will consider the object file .</p>
  
  <p>Is there any way to store data in object file then download it as zip .?? </p>
  
  <pre><code>File file = new File("/Users/VYadav/Desktop/lex/sitemap.txt");  // creates local object
  String zipFileName = "/Users/VYadav/Desktop/lex/zipname.zip";
  
  FileOutputStream fos = new FileOutputStream(zipFileName);
  ZipOutputStream zos = new ZipOutputStream(fos);
  
  PrintWriter pw=new PrintWriter(file);  // creates a physical file on disk
  pw.write("Hii");   // writes in physical file
  pw.flush();
  
  ZipEntry ze = new ZipEntry(file.getName()); // Reads from local object (here data is not present) 
  
  zos.putNextEntry(ze);
  </code></pre>
  
  <p>The out put of this code will be one txt file having "Hii" as data and a zip file containing a blank txt file .</p>
  
  <p>because file is put into zip entry from  objet.</p>
  
  <p>Is there any way to update our data in the object then download into zip folder ??</p>