5 Replies Latest reply: Jul 13, 2009 7:20 AM by 807588 RSS

    FileInputStream

    807588
      I have a zip file in directroy A.i'm unzipping the the zip file,creating a new directory in another folder and writing the file to the new folder.But its threowing me a file not found exception.Its creating problem in the FileInputStream.Suggestions plz...
        • 1. Re: FileInputStream
          791266
          revjava wrote:
          But its threowing me a file not found exception.Its creating problem in the FileInputStream.Suggestions plz...
          What? Where? When? Can you post example code that illustrates the problem?

          Kaj
          • 2. Re: FileInputStream
            807588
            Hi,

            I suggest you share some of your code. This may enable more participants in this forum to provide useful hints. Please do not forget to use the code-formatting capability of this forum.

            Bye.
            • 3. Re: FileInputStream
              807588
              ZipFile zFile = new ZipFile(tempFile);
              Enumeration zipEntries = zFile.entries();
              String logFile = null;
              String fExtn=null;
              String gbsFile=null;
              while(zipEntries.hasMoreElements())
              {
              ZipEntry zEntry = (ZipEntry)zipEntries.nextElement();          
              String fName = zEntry.getName();
              fExtn = fName.substring(fName.length()-3);
              fName=fName.substring(fName.indexOf("/")+1);
              File f;
              File fDir = new File(TMPHome+"\\BRCFiles");
              fDir.mkdirs();
              f=new File(fDir,fName);
              FileInputStream fis=new FileInputStream(f);
              BufferedInputStream inr= null;
              FileOutputStream fout=new FileOutputStream(f.getPath());
              BufferedOutputStream out=new BufferedOutputStream(fout);
              byte [] fileData = null;
              int readCount=0;
              try{
              inr = new BufferedInputStream(fis);
              while ((readCount = inr.read()) > -1)
              {
              out.write(readCount);
              }
              out.flush();
              fis.close();
              fout.close();
              inr.close();
              out.close();
              }
              catch (FileNotFoundException e)
              {e.printStackTrace();
              }
              catch (IOException e)
              {e.printStackTrace();
              }
              }//end of while
              • 4. Re: FileInputStream
                807588
                Multi-posted, unformatted manure.

                [http://forums.sun.com/thread.jspa?threadID=5397136]
                • 5. Re: FileInputStream
                  807588
                  da.futt wrote:
                  Multi-posted, unformatted manure.

                  [http://forums.sun.com/thread.jspa?threadID=5397136]
                  Locking this thread so please respond in the duplicate thread.