1   //
2   // Copyright (c) 2004, International Decision Systems
3   // all rights reserved
4   /*
5    * Copyright (c) 2005 Your Corporation. All Rights Reserved.
6    */
7   package net.sourceforge.addam.ddlrun.utils;
8   
9   import java.io.IOException;
10  
11  import net.sourceforge.addam.ddlrun.utils.ResourceReader;
12  
13  /**
14   * Doesn't actually read a resource - treats the resource name as the contents.
15   *
16   * @author TIM3
17   * @since Mar 5, 2005
18   */
19  public class MockReader implements ResourceReader {
20      public MockReader(String text) {
21          lines = text.split("\n");
22          currentLine = 0;
23      }
24  
25      public String readLine() throws IOException {
26          return (currentLine < lines.length) ? lines[currentLine++] : null;
27      }
28  
29      private final String lines[];
30      private int currentLine;
31  }