title: Assigning characters in a text file to a 2 dimensional array, by reading the file once
body: <p><em>EDIT</em> I'm an idiot. I realized I could read in the whole text file as one string, and then manipulate that string as much as I want (which would satisfy the requirement of reading in the text file one time). 
  I suppose in proposing a simpler question, how could I convert the contents of the text file into one big 'ole string? I'm just currently having a brain fart.</p>
  
  <p>Well the title pretty much says the dilemma. This is the code I've gotten complete. 
  This isn't the whole code, but generally what pertains to my issue. 
  Currently, I have it to read in the text file 2 times, where the first time instantiates the dimensions of the theMaze attribute, and the second scanner assigns the characters to the corresponding spot in the array. I don't understand how you could read in the file one time, considering you need to know the space of the contents in the text file. 
  Any help would be much appreciated! 
  Also, I'd gladly specify if you need me to. Just ask!  </p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.util.Scanner;
  
  public class maze {
  
  private char[][] theMaze;       // Will represent the maze
  private int colStart,  rowStart;    // Location of the ‘S’ symbol in the maze
  private int rows, cols;         // Number of rows and cols in the maze
  
  
  
  
  public maze(String filename) throws IOException{
  
      this.cols = 0;
      this.rows = 0;
  
      File Maze = new File(filename);
          Scanner input = new Scanner(Maze);
  
      for(rows = 0; input.hasNext() == true; rows++){
          String line = input.nextLine();
          cols = line.length();
          }
  
      this.theMaze = new char[rows][cols];
      String[] data = new String[rows];
      Scanner inputAgain = new Scanner(Maze);
  
      for(int i = 0; i &lt; rows; i++){
          data[i] = inputAgain.nextLine();
          for(int j = 0; j &lt; cols; j++){
          char placeholder = data[i].charAt(j);
          theMaze[i][j] = placeholder;
          }
      }       
      findStart();
  
      boolean yes = solve(rowStart, colStart);
      print(yes);
  }
  </code></pre>