Assume that you have a text area and you want to process its content line by line. In such a case you can easily use StringReader class.

The follwoing example shows how to print the first character of each line of a textarea content:

 String str;
        
BufferedReader reader = new BufferedReader(
  new StringReader(contentTextArea.getText()));
        
try {
  while ((str = reader.readLine()) != null) {
                
          if (str.length() > 0) System.out.println(str.charAt(0));
                
        }

} catch(IOException e) {
  e.printStackTrace();
}