Class RomsList

java.lang.Object
  extended byRomsList

public class RomsList
extends java.lang.Object

This class encapsulates a directory filled of NES ROMs and provides methods for handling these ROMs.


Constructor Summary
RomsList(java.lang.String dir)
          Class constructor.
 
Method Summary
 java.lang.String romFileName(int index)
          Returns the file name (plus extension, without the path) of the ROM pointed by index.
 java.lang.String romFullFileName(int index)
          Returns the full file name (plus path and extension) of the ROM pointed by index.
 void romReadData(int index, byte[] data)
          This methos reads the ROM's content to the array data[].
 int romsCount()
          Returns the roms count in the list.
 long romSize(int index)
          Returns the size (in bytes) of the ROM pointed by index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RomsList

public RomsList(java.lang.String dir)
Class constructor. It receives the full path for the directory containing the NES roms.

Parameters:
dir - Directory that contains the ROMS.
Method Detail

romSize

public long romSize(int index)
Returns the size (in bytes) of the ROM pointed by index.

Parameters:
index - The ROM index. It can be a value from 0 to romsCount()-1.
Returns:
Returns the ROM size, in bytes.

romFileName

public java.lang.String romFileName(int index)
Returns the file name (plus extension, without the path) of the ROM pointed by index.

Parameters:
index - The ROM index. It can be a value from 0 to romsCount()-1.
Returns:
Returns the ROM's file name.

romFullFileName

public java.lang.String romFullFileName(int index)
Returns the full file name (plus path and extension) of the ROM pointed by index.

Parameters:
index - The ROM index. It can be a value from 0 to romsCount()-1.
Returns:
Returns the ROM's full file name.

romsCount

public int romsCount()
Returns the roms count in the list.

Returns:
Returns the roms count in the list.

romReadData

public void romReadData(int index,
                        byte[] data)
This methos reads the ROM's content to the array data[]. Note that you must allocate sufficient space to data[] before calling this method. An example could be something like: byte romContents[] = new byte[(int)romsList.romSize(i)];

Parameters:
index - The ROM index. It can be a value from 0 to romsCount()-1.
data - The array which will receive the ROM's data. It must be allocated before calling this method.