Friday, 19 October 2007

Ch2, lesson2 - Reading & Writing Files.

  • All stream classes derive from abstract class Stream.
  • File class - static mthds for opening (r/w) & creating files.
  • File class - can return FileStream obj or StreamReader, StreamWriter.
  • FileStream - basic func for opening file streams for reading & writing.
  • StreamReader/StreamWriter - easier. Reads stream as string.
  • File - Open(), OpenText(), Create(), CreateText(). ...Text() ret StreamReader.
  • StringReader/Writer - read to-fro in-memory strings.
  • BinaryReader/Writer - handle binary data to/fro streams.
  • MemoryStream - to create in-memory streams. Used where need to create a stream before really need to store it.
  • MemoryStream - can wrap MemoryStream obj in StreamWriter to write to MemoryStream.

No comments: