Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. import java.io.EOFException;
  2. import java.util.Random;
  3.  
  4. public class SimpleCharacterReader implements ICharacterReader {
  5. private int m_Pos = 0;
  6.  
  7. public static final char lf = '\n';
  8.  
  9. private String m_Content = "It was the best of times, it was the worst of times," +
  10. lf +
  11. "it was the age of wisdom, it was the age of foolishness," +
  12. lf +
  13. "it was the epoch of belief, it was the epoch of incredulity," +
  14. lf +
  15. "it was the season of Light, it was the season of Darkness," +
  16. lf +
  17. "it was the spring of hope, it was the winter of despair," +
  18. lf +
  19. "we had everything before us, we had nothing before us," +
  20. lf +
  21. "we were all going direct to Heaven, we were all going direct" +
  22. lf +
  23. "the other way--in short, the period was so far like the present" +
  24. lf +
  25. "period, that some of its noisiest authorities insisted on its" +
  26. lf +
  27. "being received, for good or for evil, in the superlative degree" +
  28. lf +
  29. "of comparison only." +
  30. lf +
  31. "There were a king with a large jaw and a queen with a plain face," +
  32. lf +
  33. "on the throne of England; there were a king with a large jaw and" +
  34. lf +
  35. "a queen with a fair face, on the throne of France. In both" +
  36. lf +
  37. "countries it was clearer than crystal to the lords of the State" +
  38. lf +
  39. "preserves of loaves and fishes, that things in general were" +
  40. lf +
  41. "settled for ever";
  42.  
  43. Random m_Rnd = new Random();
  44.  
  45. public char GetNextChar() throws EOFException {
  46.  
  47. if (m_Pos >= m_Content.length()) {
  48. throw new EOFException();
  49. }
  50.  
  51. return m_Content.charAt(m_Pos++);
  52.  
  53. }
  54.  
  55. public void Dispose() {
  56. // do nothing
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement