Results 1 to 2 of 2
Thread: reading from a zip file, error
- 12-18-2007, 02:40 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 12
- Rep Power
- 0
reading from a zip file, error
Im trying to read a file from a zip file using the following method:
but just after System.out.println("d" ); I get an error?PHP Code:public void readZipFiles(String filename) { try { byte[] buf = new byte[1024]; ZipInputStream zipinputstream = null; ZipEntry zipentry; zipinputstream = new ZipInputStream( new FileInputStream(filename)); zipentry = zipinputstream.getNextEntry(); while (zipentry != null) { //for each entry to be extracted String entryName = zipentry.getName(); System.out.println("File ::"+entryName); RandomAccessFile rf; File newFile = new File(entryName); String directory = newFile.getParent(); if(directory == null) { if(newFile.isDirectory()) break; } System.out.println("d" ); rf = new RandomAccessFile(entryName,"r"); System.out.println("e" ); String line; if ((line =rf.readLine()) !=null) { System.out.println(line); } rf.close(); zipinputstream.closeEntry(); zipentry = zipinputstream.getNextEntry(); }//while zipinputstream.close(); } catch (Exception e) { e.printStackTrace(); } }
File:: jav_4250.pdf
a
b
c
d
java.io.FileNotFoundException: jav_4250.pdf
but why is it not found if it just got it from the zip?
- 01-16-2008, 12:39 AM #2
Similar Threads
-
Reading a file
By mew in forum New To JavaReplies: 2Last Post: 12-30-2007, 12:23 PM -
Reading a file for use
By peachyco in forum New To JavaReplies: 2Last Post: 11-27-2007, 03:49 AM -
Reading Data from a file
By ramachandran in forum New To JavaReplies: 2Last Post: 10-24-2007, 07:22 AM -
Help with File reading and writing
By baltimore in forum New To JavaReplies: 1Last Post: 07-31-2007, 06:47 PM -
Reading from a file
By leebee in forum New To JavaReplies: 1Last Post: 07-23-2007, 12:02 PM


LinkBack URL
About LinkBacks

Bookmarks