Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Limited file reading from directory  RSS feed

 
pavan sharma
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am reading all files from directory.........i,e

File orgf = new File("E:/ImageProject/ImageDir/");

String[] OrgFile=orgf.list();

It returns all files available in ImageDir....but i want to read limited i.e only 5 or 10 files from that direcotry...


Is there any file function..........i don't want to set limit after reading....all file.............set to limit while reading...........
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you can't read only a subset.
Why do you want to do this?

You do realize that the list() method doesn't actually parse each of those files, right? It's only reading the file list in the directory (which is really just a type of file).
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this has nothing to do with JSP, I'm going to move it to our I/O and Streams forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!