ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 회사에서 끄적끄적 글 쓰는 중
    과거...../개발일지 2010. 7. 5. 15:15

    압축 파일에서 압축을 하지 않고 이미지를  미리 보기 구현은 어떻게 하는것인가??

    이 주제로 할 일 없어서 몇시간 째 고민중.......................................................

    사용자 몰래 압축을 1장씩 풀고 지워주는 것인가? or 그냥 압축을 한장씩 메모리에 풀어서 사용자에게 보여 주는 것인가??

    >< 이 두가지............................어찌 하든....한장씩 압축을 푼다는 결론에 도달하기는 한다.
    일단 만들고 있는 부분 소스 업데이트...


     public static void unzip(String path, String fileName) {
      
      int current_count=0;
      
      try {
       FileInputStream fis = new FileInputStream(path + fileName);
       ZipInputStream zis = new ZipInputStream(fis);
       ZipEntry ze;

       while ((ze = zis.getNextEntry()) != null) {    
        System.out.println(ze.getName());
        
        OutputStream out = new FileOutputStream(path + ze.getName());
        byte[] buf = new byte[(int) ze.getSize()];
        int len;
        zis.skip(0);
        
        while ((len = zis.read(buf)) > 0) {
         out.write(buf, 0, len);     
        }
        out.close();
        zis.closeEntry();
        //deletefile(path,ze.getName());
       }

       zis.close();
      } catch (FileNotFoundException e) {
       e.printStackTrace();
      } catch (IOException e) {
       e.printStackTrace();
      }
     }
     
     
     public static void deletefile(String path, String fileName){  
      File delet = new File(path + fileName);
      delet.delete();  
     }




Designed by Tistory.