title: Reading Multi-Line Input From Command Line at once
body: <p>I have a need for a simple class to read multi-line input at once.
  For example, reading these two lines at once from a buffer:</p>
  <blockquote>
  <p>b8 b7</p>
  <p>g8 g2</p>
  </blockquote>
  <p>This code only inputs the first line from the buffer, and without the first character...</p>
  <pre><code>int avail = System.in.read();
  byte[] buf = new byte[avail];
  System.in.read(buf);
  String s = new String(buf);
  String[] lines = s.split(&quot;\n&quot;);
  
  //System.out.println(lines);
          
  for(int i=0; i&lt;lines.length; i++) {
      System.out.println(lines[i]);
  }
  </code></pre>