[Solved] Reading data from text line by line in java


This should do it. Obviously you’ll need to handle exceptions:

public class FileReaderTest
{
  public static void main(String[] args) throws IOException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
  {
    final FileReaderTest object = new FileReaderTest(); 

    final BufferedReader reader = new BufferedReader(new FileReader(new File("/path/to/file")));
    for (String line = reader.readLine(); line != null; line = reader.readLine())
    {
      object.getClass().getMethod(line).invoke(object);
    }
  }
}

0

solved Reading data from text line by line in java