4 Replies Latest reply on Oct 15, 2008 4:47 PM by 807589

    FTP zip file entries

    807589
      My application remotly conects (via ftp) to a remote server.
      in that server there is a list of zip files.

      i need the ability to view the entries in each zip file WITHOUT downloading it first.
      after I'll get the remote file's entries - I'll know if I should download it.

      Thanks,
      Carola.
        • 1. Re: FTP zip file entries
          800322
          carol_ab wrote:
          i need the ability to view the entries in each zip file WITHOUT downloading it first.
          No problem, if you can make the server look into the file for you. I can imagine some FTP server implementation handling ZIPs as pseudo-directories just like Windows does, but I'm not at all sure whether any actually allows that.

          If you can't do anything about the server, you're short of luck.
          • 2. Re: FTP zip file entries
            807589
            I guess I'm out of luck - my application is running on several different servers.

            I tried using:
            zis = new ZipInputStream( client.retrieveFileStream( zipFileName ) );
            for( ZipEntry ent = zis.getNextEntry(); ent != null; ent = zis.getNextEntry() )
            {
            
            String currentEntry = ent.getName();
            if( condition )
            {
                 foundMatch = true;
                 break;
            }
            }
            if (zis!=null)
               zis.close();
            zis=null;
            This way I'm reading the whole zip file.
            I keep getting this error after the first file was proccessed:
            java.lang.NullPointerException: in is null
                 at java.util.zip.ZipInputStream.<init>(Unknown Source)
            Am i missing anything?

            Thanks,
            Carol.

            Edited by: carol_ab on Oct 15, 2008 8:14 AM
            • 3. Re: FTP zip file entries
              807589
              carol_ab wrote:
              I guess I'm out of luck -
              Yes you're out of luck. You must download the file.
              I keep getting this error after the first file was proccessed:
              java.lang.NullPointerException: in is null
                   at java.util.zip.ZipInputStream.<init>(Unknown Source)
              Am i missing anything?
              Missing what exactly? You close the input stream and then set it to null (which is a mistake for a whole bunch of reasons) and are then surprised that further references throw a NullPointerException?

              I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
              • 4. Re: FTP zip file entries
                807589
                >
                [snip]
                I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
                The Charles Babbage equivalent of :blink: