TextReader.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // System.IO.TextReader
  3. //
  4. // Author: Marcin Szczepanski ([email protected])
  5. //
  6. // TODO: Implement the Thread Safe stuff
  7. //
  8. using System;
  9. namespace System.IO {
  10. [MonoTODO]
  11. public abstract class TextReader : MarshalByRefObject, IDisposable {
  12. protected TextReader() { }
  13. public static readonly TextReader Null;
  14. public virtual void Close()
  15. {
  16. Dispose(true);
  17. }
  18. void System.IDisposable.Dispose()
  19. {
  20. Dispose(true);
  21. }
  22. protected virtual void Dispose( bool disposing )
  23. {
  24. return;
  25. }
  26. public virtual int Peek()
  27. {
  28. return -1;
  29. }
  30. public virtual int Read()
  31. {
  32. return -1;
  33. }
  34. // LAMESPEC: The Beta2 docs say this should be Read( out char[] ...
  35. // whereas the MS implementation is just Read( char[] ... )
  36. // Not sure which one is right, we'll see in Beta3 :)
  37. public virtual int Read (char[] buffer, int index, int count)
  38. {
  39. int c, i;
  40. for (i = 0; i < count; i++) {
  41. if ((c = Read ()) == -1)
  42. return i;
  43. buffer [index + i] = (char)c;
  44. }
  45. return i;
  46. }
  47. public virtual int ReadBlock( char[] buffer, int index, int count )
  48. {
  49. return 0;
  50. }
  51. public virtual string ReadLine()
  52. {
  53. return String.Empty;
  54. }
  55. public virtual string ReadToEnd()
  56. {
  57. return String.Empty;
  58. }
  59. [MonoTODO]
  60. public static TextReader Synchronised( TextReader reader )
  61. {
  62. // TODO: Implement
  63. return Null;
  64. }
  65. }
  66. }