I want to read image names from a folder
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   samineni2000_ravi
Posted On:   Saturday, December 14, 2002 12:09 AM

I have some images in folder c:
aviimages


I want to read and store the names of the images which are in image folder.


Any body help me by giving code

Re: I want to read image names from a folder

Posted By:   AlessandroA_Garbagnati  
Posted On:   Saturday, December 14, 2002 12:28 AM

Hi,

I can give you some hints and information that will help you to develop the code.


The java.io.File class contains methods like list() or listFiles() that will return the list of a file as an array of String or File objects.


You can create a class that implements the java.io.FilenameFilter interface. The only method you have to implement is accept() where you define which are the filenames you want to include in your listing. For example you can accept all the files that have the jgp, png or gif extension.


Once you have that class, you can pass it to the list() or listFiles() methods, and you will get the array with all the images files in your dir.

About | Sitemap | Contact