[Nmrshiftdb-devel] CVS: nmrshiftdb/src/java/org/openscience/nmrshiftdb/util GeneralUtils.java, 1.1
Brought to you by:
steinbeck
|
From: Stefan K. <sh...@us...> - 2006-09-23 22:10:50
|
Update of /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/util In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv12776/src/java/org/openscience/nmrshiftdb/util Modified Files: GeneralUtils.java Log Message: no arrows after files Index: GeneralUtils.java =================================================================== RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/util/GeneralUtils.java,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -r1.186 -r1.187 *** GeneralUtils.java 29 Aug 2006 16:10:05 -0000 1.186 --- GeneralUtils.java 23 Sep 2006 22:10:44 -0000 1.187 *************** *** 149,152 **** --- 149,155 ---- static GeneralUtils instance=new GeneralUtils(); + //attention - problem with static + public static Vector alreadyAttached=new Vector(); + /** *Constructor for the GeneralUtils object (private since only static methods) *************** *** 1844,1857 **** int bytesIn = 0; byte[] readBuffer = new byte[2156]; ! FileInputStream fis = new FileInputStream(zipDir); ! ZipEntry anEntry = new ZipEntry(zipDir.getPath()); ! //place the zip entry in the ZipOutputStream object ! zos.putNextEntry(anEntry); ! //now write the content of the file to the ZipOutputStream ! while ((bytesIn = fis.read(readBuffer)) != -1) { ! zos.write(readBuffer, 0, bytesIn); } - //close the Stream - fis.close(); }else{ //get a listing of the directory content --- 1847,1863 ---- int bytesIn = 0; byte[] readBuffer = new byte[2156]; ! if(!alreadyAttached.contains(zipDir.getPath())){ ! FileInputStream fis = new FileInputStream(zipDir); ! ZipEntry anEntry = new ZipEntry(zipDir.getPath()); ! alreadyAttached.add(zipDir.getPath()); ! //place the zip entry in the ZipOutputStream object ! zos.putNextEntry(anEntry); ! //now write the content of the file to the ZipOutputStream ! while ((bytesIn = fis.read(readBuffer)) != -1) { ! zos.write(readBuffer, 0, bytesIn); ! } ! //close the Stream ! fis.close(); } }else{ //get a listing of the directory content *************** *** 1870,1885 **** continue; } ! //if we reached here, the File object f was not a directory ! //create a FileInputStream on top of f ! FileInputStream fis = new FileInputStream(f); ! ZipEntry anEntry = new ZipEntry(getRelativePath(rawdatadir,f)); ! //place the zip entry in the ZipOutputStream object ! zos.putNextEntry(anEntry); ! //now write the content of the file to the ZipOutputStream ! while ((bytesIn = fis.read(readBuffer)) != -1) { ! zos.write(readBuffer, 0, bytesIn); } - //close the Stream - fis.close(); } } --- 1876,1894 ---- continue; } ! if(!alreadyAttached.contains(getRelativePath(rawdatadir,f))){ ! //if we reached here, the File object f was not a directory ! //create a FileInputStream on top of f ! FileInputStream fis = new FileInputStream(f); ! ZipEntry anEntry = new ZipEntry(getRelativePath(rawdatadir,f)); ! alreadyAttached.add(getRelativePath(rawdatadir,f)); ! //place the zip entry in the ZipOutputStream object ! zos.putNextEntry(anEntry); ! //now write the content of the file to the ZipOutputStream ! while ((bytesIn = fis.read(readBuffer)) != -1) { ! zos.write(readBuffer, 0, bytesIn); ! } ! //close the Stream ! fis.close(); } } } |