-1

I have a file with extension .ivt. I have to get description and summary of the file. Everything is stored in file properties. It contains the author, description and date of creation. I looked all over the internet and did not find any code that can do that. Is there any way I can extract that information from the file using java?

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
Deep
  • 108
  • 1
  • 1
  • 12
  • I just want file properties like author name, file description written by the author, date created, etc using java – Deep Jul 18 '15 at 15:04
  • Check out [this SO](http://stackoverflow.com/questions/2723838/determine-file-creation-date-in-java) as what you are asking could very well be OS specific. – Codebender Jul 18 '15 at 15:07
  • Thanks for this but, I want more advance information that is specific to the file like description written by the author – Deep Jul 18 '15 at 15:12

1 Answers1

0
public class File{
  public static void main(String[] args) throws IOException {
    Path path = Paths.get("/tmp");
    FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class);
    UserPrincipal owner = ownerAttributeView.getOwner();
    System.out.println("owner: " + owner.getName());
  }
}

This gets you details like create, file date, etc.: `

BufferedReader br = new BufferedReader(
    new InputStreamReader(path.getInputStream()));
String data ="";
for(int i=0; i<6; i++){
    data = br.readLine();
}
System.out.println("Extracted value : " + data);
StringTokenizer st = new StringTokenizer(data);
String date = st.nextToken();//Get date
String time = st.nextToken();//Get time
System.out.println("Creation Date  : " + date);
System.out.println("Creation Time  : " + time);
durron597
  • 31,968
  • 17
  • 99
  • 158
Anand Dwivedi
  • 1,452
  • 13
  • 23