2014-11-04 2 views
1

내 목표는 매우 간단합니다. 내 자산 폴더에 zip 파일이 있으며 마지막으로 수정 한 날짜를 얻으려고합니다.자산 폴더에있는 항목의 lastModified 날짜를 가져 오는 중입니까?

나는 Assetmanager를 통해 파일을 액세스하고 그것에서 파일을 만들 수 있어요,하지만 수정 된 날짜가 파일이 사람이 내가 실제 액세스 할 수있는 방법을 생각할 수

AssetManager manager; 
    File checkFile = new File(source + "/" + "test.zip"); 

    try 
    { 
     InputStream stream = manager.open(fileToCheck); 
     int size = stream.available(); 
     byte[] buffer = new byte[size]; 
     stream.read(buffer); 
     stream.close(); 

     FileOutputStream fos = new FileOutputStream(checkFile); 
     fos.write(buffer); 
     fos.close(); 
    } 
    catch(IOException ioExc) 
    { 
     //stuff 
    } 

     long lastMod = checkFile.lastModified(); 

     Date lastMod = new Date(lastMod); //This is returning the current time, 
              //NOT the modified date of the file 

을 기록되는 순간이다 assets 폴더에있는 파일의 최종 수정 날짜? 어떤 도움이라도 대단히 감사하겠습니다!

답변

0

가장 쉬운 방법은 마지막 수정 날짜를 해당 zip 파일 (예 : lastmod.txt)에 포함시키는 것입니다. 그런 다음 압축을 풀고 해당 파일을 읽을 수 있습니다.

관련 문제