Skip to Content

Get All Entries From Zip File Example

  • strict warning: Non-static method view::load() should not be called statically in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/views.module on line 906.
  • strict warning: Declaration of views_handler_argument::init() should be compatible with views_handler::init(&$view, $options) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_argument.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter.inc on line 0.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/handlers/views_handler_filter_boolean_operator.inc on line 0.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_style_default.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_row.inc on line 0.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/javaexa1/public_html/sites/all/modules/views-6.x-2.16/views/plugins/views_plugin_row.inc on line 0.

  1. /*
  2.         Get All Entries From Zip File Example.
  3.         This Java example shows how to get enumeration of all entries
  4.         (i.e. files or directories) using entries method of
  5.         Java ZipFile class.
  6. */
  7.  
  8. import java.io.IOException;
  9. import java.util.Enumeration;
  10. import java.util.zip.ZipEntry;
  11. import java.util.zip.ZipFile;
  12.  
  13. public class GetAllEntries {
  14.        
  15.         public static void main(String args[])
  16.         {
  17.                  try
  18.                  {
  19.                         /*
  20.                          * Open zip file using,
  21.                          *
  22.                          * ZipFile(String fileName)
  23.                          * constructor of the ZipFile class.
  24.                          *
  25.                          * This constructor throws IOException for any I/O error.
  26.                          */
  27.                         ZipFile zipFile = new ZipFile("c:/FileIO/WebFiles.zip");
  28.  
  29.                         /*
  30.                          * To get all entries from opened zip file, use
  31.                          *
  32.                          * Enumeration entries()
  33.                          * method of ZipFile class.
  34.                          *
  35.                          * This method returns Enumeration of zip file entries.
  36.                          */
  37.                        
  38.                         Enumeration e = zipFile.entries();
  39.                                                
  40.                         /*
  41.                          * PLEASE VISIT ZipEntry Examples for more details on
  42.                          * how to process entries.
  43.                          */
  44.                  
  45.                         /*
  46.                          * close the opened zip file using,
  47.                          * void close()
  48.                          * method.
  49.                          */
  50.                          
  51.                          zipFile.close();
  52.        
  53.                  }
  54.                  catch(IOException ioe)
  55.                  {
  56.                         System.out.println("Error opening zip file" + ioe);
  57.                  }
  58.         }
  59. }