myDataBases
Class MyDirectory

java.lang.Object
  extended by myDataBases.MyDirectory

public class MyDirectory
extends java.lang.Object

Class MyDirectory ; allows to retrieve the names of the media to sort as well as other characteristics.

The media can be stored in a folder, in which case they must be the only thing present in it, or their names and other characteristics can be stored in the data/media.xml file. The aim of this class is to allow other part of this program to access quickly and simply to these informations.

Author:
Leo Perrin (perrin.leo@gmail.com)

Field Summary
private  java.lang.String[] content
          The list of the media contained in the folder.
private  java.lang.String mediaPath
          The path to the place where media are stored, either a file or a folder.
 
Constructor Summary
MyDirectory(java.lang.String path)
          Creates an instance of MyDirectory and sets its attributes.
 
Method Summary
 java.lang.Integer[] getAllMedia()
          Returns an array of Integer containing the ID of all the media present in the folder.
 java.lang.String getMedia(java.lang.Integer ID)
          Returns the path of the media wanted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mediaPath

private java.lang.String mediaPath
The path to the place where media are stored, either a file or a folder.


content

private java.lang.String[] content
The list of the media contained in the folder. Their rank in the list corresponds to their ID.

Constructor Detail

MyDirectory

public MyDirectory(java.lang.String path)
Creates an instance of MyDirectory and sets its attributes. Sets the value of the attribute mediaPath to path and generates a list containing all the media, content either by reading the path file or by listing the content of the path directory.

Parameters:
path - Path to the directory to be used or to the file containing the URLs
Method Detail

getAllMedia

public java.lang.Integer[] getAllMedia()
Returns an array of Integer containing the ID of all the media present in the folder. Since all media are stored in a simple list, they all have a unique rank in it. Therefore, this methods simply returns all integers from 0 to $(number of media)-1.

Returns:
Integer[]

getMedia

public java.lang.String getMedia(java.lang.Integer ID)
Returns the path of the media wanted.

Parameters:
ID - The identifier of the media wanted.
Returns:
String