title: Getting an InputStream to read more than once, regardless of markSupported()
body: <p>I need to be able to re-use a <code>java.io.InputStream</code> multiple times, and I figured the following code would work, but it only works the first time.</p>
  
  <h2>Code</h2>
  
  <hr>
  
  <pre><code>public class Clazz
  {
    private java.io.InputStream dbInputStream, firstDBInputStream;
    private ArrayTable db;
  
    public Clazz(java.io.InputStream defDB)
    {
      this.firstDBInputStream = defDB;
      this.dbInputStream = defDB;
      if (db == null)
        throw new java.io.FileNotFoundException("Could not find the database at " + db);
      if (dbInputStream.markSupported())
        dbInputStream.mark(Integer.MAX_VALUE);
      loadDatabaseToArrayTable();
    }
  
    public final void loadDatabaseToArrayTable() throws java.io.IOException
    {
      this.dbInputStream = firstDBInputStream;
      if (dbInputStream.markSupported())
        dbInputStream.reset();
  
      java.util.Scanner fileScanner = new java.util.Scanner(dbInputStream);
      String CSV = "";
      for (int i = 0; fileScanner.hasNextLine(); i++)
        CSV += fileScanner.nextLine() + "\n";
      db = ArrayTable.createArrayTableFromCSV(CSV);
    }
  
    public void reloadDatabase()//A method called by the UI
    {
      try
      {
        loadDatabaseToArrayTable();
      }
      catch (Throwable t)
      {
        //Alert the user that an error has occurred
      }
    }
  }
  </code></pre>
  
  <blockquote>
    <p>Note that ArrayTable is a class of mine, which uses arrays to give an interface for working with tables.</p>
  </blockquote>
  
  <h2>Question</h2>
  
  <hr>
  
  <p>In this program, the database is shown directly to the user immediately after the <code>reloadDatabase()</code> method is called, and so any solution involving saving the initial read to an object in memory is useless, as that will NOT refresh the data (think of it like a browser; when you press "Refresh", you want it to fetch the information again, not just display the information it fetched the first time). <strong>How can I read a <code>java.io.InputStream</code> more than once?</strong></p>