import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

/**
 * Liest Textdateien aus
 * 
 * @author Felix Pfeffer 
 * @version 1.0
 */
public class Reader extends Actor
{
    /**
      * Pfad der Datei
      */
    protected File f;
     /**
      * Scanner
      */
    protected Scanner s;
    
     
    public Reader(String r)
    {
        f = new File(r);
        try
        {
            s = new Scanner(f);
        }
        catch( FileNotFoundException e )
        {
            e.printStackTrace();
        }
    }
     /**
      * liest nächste Integer aus .txt Datei aus
      */
    public int readInt()
    {
        if( s.hasNext() )
        {
            return s.nextInt();
        }
        
        return -1;
    }
    /**
      * Beendet Scanner
      */
    public void close()
    {
        s.close();
    }  
}
