title: Can't get zip entries from DataInputStream
body: <p>I have to unzip a zip data package which is addressed via an URL. (The URL and DataInputStream are correct!)</p>
  
  <pre><code>private void unZipIt(File baseDir, DataInputStream dis, PipedOutputStream pos) throws ZipException
  {
      byte[] buffer = new byte[1024];
      String fileName = "";
      File newFile;
      FileOutputStream fos = null;
  
      try
      {
          ZipInputStream zis = new ZipInputStream(dis);
          ZipEntry ze = zis.getNextEntry();
  
          if(ze==null)
          {
              System.out.println("first zip entry is null");
          }
  
          while (ze != null)
          {
              System.out.println("zip entry is not null");
              fileName = ze.getName();
              newFile = new File(baseDir + File.separator + fileName);
  
              if (isSavFile(fileName))
              {
                  System.out.println(fileName + "is savfile");
                  new File(newFile.getParent()).mkdirs();
  
                  fos = new FileOutputStream(newFile);
  
                  int len;
                  while ((len = zis.read(buffer)) &gt; 0)
                  {
                      fos.write(buffer, 0, len);
                  }
  
                  // fos.close();
              }
              ze = zis.getNextEntry();
          }
          zis.closeEntry();
          zis.close();
          // return true;
      }
      catch (IOException e)
      {
          // ex.printStackTrace();
          log.error("unzipping '" + fileName + "'", e);
          throw new ZipException(fileName, e);
          // return false;
      }
  </code></pre>
  
  <p>But it is not possible to get any of the zip entries. (first zip entry is null!)
  With a FileOutputStream it worked perfectly. Because of the efficiency I am not allowed to store the file on the PC.</p>
  
  <p>Anyone an idea?</p>