문제
고 싶 추출하려면 날짜 jpg 파일을 만들었습니다.Java 는 lastModified 방법에 대한 파일 개만 나타 지원을 제공하지 추출하기 위한 만든 파일에서 날짜.나는 정보가 저장된 내일 날짜로 내가 볼 때 나는 마우스 포인터를 통해 파일에서 Win XP 에서는 서로 다른 것보다 나는 무엇을 얻을 수 있을 사용하여 JNI"dir/TC"에서 파일에서는 DOS.
다른 팁
내가 사용하는 이 메타데이터는 라이브러리: http://www.drewnoakes.com/code/exif/
작동하는 것 같다 꽤 있지만,마음에 부담하는지 JPEG 이미지가 이러한 정보를,그래서 그것은 있을 수 없 100%니다.
는 경우 EXIF 메타데이터가 포함되어 있지 않 만든 날짜,그 다음 당신은 아마이 있을 할 수 있도록으로 자바의 lastUpdated-지 않는 한 당신은 리조트를 원합니다.exec(...)과 시스템을 사용하여 기능을 찾아(이 없지만!)
아래의 예제 코드 요청에 대한 사용자의 파일 경로와 그 다음 출력 생성 날짜와 시간:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(final String[] args) {
try {
// get runtime environment and execute child process
Runtime systemShell = Runtime.getRuntime();
BufferedReader br1=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter filename: ");
String fname=(String)br1.readLine();
Process output = systemShell.exec("cmd /c dir /a "+fname);
// open reader to get output from process
BufferedReader br = new BufferedReader (new InputStreamReader(output.getInputStream()));
String out="";
String line = null;
int step=1;
while((line = br.readLine()) != null )
{
if(step==6)
{
out=line;
}
step++;
} // display process output
try{
out=out.replaceAll(" ","");
System.out.println("CreationDate: "+out.substring(0,10));
System.out.println("CreationTime: "+out.substring(10,15));
}
catch(StringIndexOutOfBoundsException se)
{
System.out.println("File not found");
}
}
catch (IOException ioe){ System.err.println(ioe); }
catch (Throwable t) { t.printStackTrace();}
}
}
제휴하지 않습니다 StackOverflow