Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Find File Size

 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..

I need to find .pdf and .eps(encapsulated post script) file size but i cant., can you anyone help me.

thanks
Prabhakaran.N
 
Dave Jones
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
If you have the file name, then you can check the possibilities of the 'File ' class.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
length() method of File Class is return the file size in bytes.
See Java Doc for more clarification. or try google for it. you'll definitely find some example on it.
 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..thanks for reply.,

all "File" related funtions tell about lengh of file like

System.out.println("File size = " +new
File("D:\\NPrabhakaran\\Important.doc").length());
 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Saif,

but it is not working for .pdf and .eps files.

thanks.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Natesan Prabhakaran:
but it is not working for .pdf and .eps files.


try this code..



I have checked this code in my machine and it works fine.
[ September 05, 2007: Message edited by: Saif uddin ]
 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes Saif,
thank you., now i got.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic