<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FFile_Directory_Stream%2FStream</id>
		<title>Csharp/CSharp Tutorial/File Directory Stream/Stream - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://nfex.ru/index.php?action=history&amp;feed=atom&amp;title=Csharp%2FCSharp_Tutorial%2FFile_Directory_Stream%2FStream"/>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/File_Directory_Stream/Stream&amp;action=history"/>
		<updated>2026-04-29T23:13:40Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/File_Directory_Stream/Stream&amp;diff=6802&amp;oldid=prev</id>
		<title> в 15:31, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/File_Directory_Stream/Stream&amp;diff=6802&amp;oldid=prev"/>
				<updated>2010-05-26T15:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 15:31, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/File_Directory_Stream/Stream&amp;diff=6803&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://nfex.ru/index.php?title=Csharp/CSharp_Tutorial/File_Directory_Stream/Stream&amp;diff=6803&amp;oldid=prev"/>
				<updated>2010-05-26T12:20:27Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==C#&amp;quot;s I/O Is Built Upon Streams==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;C# programs perform I/O through streams.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;A stream is linked to a physical device by the C# I/O system.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;The I/O classes and methods can be applied to many types of devices.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;At the lowest level, all C# I/O systems operate on bytes.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The Predefined Streams&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;Console.Out: the standard output stream.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Console.In: standard input, which is by default the keyboard.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Console.Error: the standard error stream, which is also the console by default.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
15.18.Stream&lt;br /&gt;
15.18.1.&lt;br /&gt;
C#&amp;quot;s I/O Is Built Upon Streams&lt;br /&gt;
15.18.2.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/TheStreamClasses.htm&amp;quot;&amp;gt;The Stream Classes&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.3.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/TheByteStreamClassesandTheCharacterStreamWrapperClasses.htm&amp;quot;&amp;gt;The Byte Stream Classes and The Character Stream Wrapper Classes&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.4.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/StreamseekingSeekOriginCurrentSeekOriginBeginSeekOriginEnd.htm&amp;quot;&amp;gt;Stream seeking: SeekOrigin.Current, SeekOrigin.Begin, SeekOrigin.End&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.5.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/Usingstreamreadertodecodestreams.htm&amp;quot;&amp;gt;Using streamreader to decode streams&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.6.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/Usingstreamreadertoreadentirelinesatatime.htm&amp;quot;&amp;gt;Using streamreader to read entire lines at a time&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.7.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/Usingstreamreadertoreadtheentirestreamatonce.htm&amp;quot;&amp;gt;Using streamreader to read the entire stream at once&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.8.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/Readingfromastreamcastingtochars.htm&amp;quot;&amp;gt;Reading from a stream, casting to chars&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.9.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/Readingfromastreambufferatatime.htm&amp;quot;&amp;gt;Reading from a stream buffer at a time&amp;lt;/a&amp;gt;&lt;br /&gt;
15.18.10.&lt;br /&gt;
&amp;lt;A href=&amp;quot;/Tutorial/CSharp/0300__File-Directory-Stream/ImplementingBinaryReadWriteToFile.htm&amp;quot;&amp;gt;Implementing Binary Read Write To File&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Implementing Binary Read Write To File==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.IO;&lt;br /&gt;
&lt;br /&gt;
    class Tester&lt;br /&gt;
    {&lt;br /&gt;
        public static void Main()&lt;br /&gt;
        {&lt;br /&gt;
            int SizeBuff = 1024;&lt;br /&gt;
             Stream inputStream = File.OpenRead(&amp;quot;test1.cs&amp;quot;);&lt;br /&gt;
            Stream outputStream = File.OpenWrite(&amp;quot;test1.bak&amp;quot;);&lt;br /&gt;
            byte[] buffer = new Byte[SizeBuff];&lt;br /&gt;
            int bytesRead;&lt;br /&gt;
            while ((bytesRead =&lt;br /&gt;
            inputStream.Read(buffer, 0, SizeBuff)) &amp;gt; 0)&lt;br /&gt;
            {&lt;br /&gt;
                outputStream.Write(buffer, 0, bytesRead);&lt;br /&gt;
            }&lt;br /&gt;
            inputStream.Close();&lt;br /&gt;
            outputStream.Close();&lt;br /&gt;
        }&lt;br /&gt;
    }&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reading from a stream buffer at a time==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        using (Stream s = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open))&lt;br /&gt;
        {&lt;br /&gt;
            int readCount;&lt;br /&gt;
            byte[] buffer = new byte[4096];&lt;br /&gt;
            while ((readCount = s.Read(buffer, 0, buffer.Length)) != 0)&lt;br /&gt;
            {&lt;br /&gt;
                for (int i = 0; i &amp;lt; readCount; i++)&lt;br /&gt;
                {&lt;br /&gt;
                    Console.Write(&amp;quot;{0} &amp;quot;, buffer[i]);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Reading from a stream, casting to chars==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        using (Stream s = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open))&lt;br /&gt;
        {&lt;br /&gt;
            int read;&lt;br /&gt;
            while ((read = s.ReadByte()) != -1)&lt;br /&gt;
            {&lt;br /&gt;
                Console.Write(&amp;quot;{0} &amp;quot;, (char)read);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stream seeking: SeekOrigin.Current, SeekOrigin.Begin, SeekOrigin.End==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Net.Sockets;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        using (Stream s = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open))&lt;br /&gt;
        {&lt;br /&gt;
            s.Seek(8, SeekOrigin.Current);&lt;br /&gt;
            Console.WriteLine(s.ReadByte());&lt;br /&gt;
            s.Seek(0, SeekOrigin.Begin);&lt;br /&gt;
            Console.WriteLine(s.ReadByte());&lt;br /&gt;
            s.Seek(-1, SeekOrigin.End);&lt;br /&gt;
            Console.WriteLine(s.ReadByte());&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Byte Stream Classes and The Character Stream Wrapper Classes==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The Byte Stream Classes&amp;lt;/p&amp;gt;&lt;br /&gt;
Stream Class&lt;br /&gt;
Description&lt;br /&gt;
BufferedStream&lt;br /&gt;
Wraps a byte stream and adds buffering.&lt;br /&gt;
FileStream&lt;br /&gt;
A byte stream designed for file I/O.&lt;br /&gt;
MemoryStream&lt;br /&gt;
A byte stream that uses memory for storage.&lt;br /&gt;
&amp;lt;p&amp;gt;The Character Stream Wrapper Classes.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;To create a character stream, wrap a byte stream inside one of C#&amp;quot;s character stream wrappers.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;The abstract classes TextReader and TextWriter are at the top of the character stream hierarchy.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;TextReader handles input.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;TextWriter handles output.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Stream Classes==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;System.IO.Stream represents a byte stream&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;System.IO.Stream is a base class for all other stream classes.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;System.IO.Stream is abstract.&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Some of the Methods Defined by Stream&amp;lt;/p&amp;gt;&lt;br /&gt;
Method&lt;br /&gt;
Description&lt;br /&gt;
void Close()&lt;br /&gt;
Closes the stream.&lt;br /&gt;
void Flush()&lt;br /&gt;
Flush the stream.&lt;br /&gt;
int ReadByte()&lt;br /&gt;
Returns an integer representation of a byte of input. Returns -1 if no byte is available.&lt;br /&gt;
int Read(byte[ ] buf,int offset, int numBytes)&lt;br /&gt;
Attempts to read up to numBytes bytes into buf starting at buf[offset], returning the number of bytes successfully read.&lt;br /&gt;
long Seek(long offset,SeekOrigin origin)&lt;br /&gt;
Sets the current position in the stream to the specified offset from the specified origin.&lt;br /&gt;
void WriteByte(byte b)&lt;br /&gt;
Writes a single byte to an output stream.&lt;br /&gt;
void Write(byte[ ] buf,int offset, int numBytes)&lt;br /&gt;
Writes a subrange of numBytes bytes from the array buf, beginning at buf[offset].&lt;br /&gt;
&amp;lt;p&amp;gt;The Properties Defined by Stream&amp;lt;/p&amp;gt;&lt;br /&gt;
Method&lt;br /&gt;
Description&lt;br /&gt;
bool CanRead&lt;br /&gt;
can be read or not. (read-only)&lt;br /&gt;
bool CanSeek&lt;br /&gt;
supports position requests or not. (read-only)&lt;br /&gt;
bool CanWrite&lt;br /&gt;
can be written or not. (read-only)&lt;br /&gt;
long Length&lt;br /&gt;
the length of the stream. (read-only)&lt;br /&gt;
long Position&lt;br /&gt;
the current position of the stream. (read/write)&lt;br /&gt;
&lt;br /&gt;
==Using streamreader to decode streams==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Net.Sockets;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Stream s = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open);&lt;br /&gt;
        using (StreamReader sr = new StreamReader(s, Encoding.UTF8))&lt;br /&gt;
        {&lt;br /&gt;
            int readCount;&lt;br /&gt;
            char[] buffer = new char[1024];&lt;br /&gt;
            while ((readCount = sr.Read(buffer, 0, 1024)) != 0)&lt;br /&gt;
            {&lt;br /&gt;
                for (int i = 0; i &amp;lt; readCount; i++)&lt;br /&gt;
                {&lt;br /&gt;
                    Console.Write(&amp;quot;{0} &amp;quot;, buffer[i]);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using streamreader to read entire lines at a time==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Net.Sockets;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
        Stream s = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open);&lt;br /&gt;
        using (StreamReader sr = new StreamReader(s, Encoding.UTF8))&lt;br /&gt;
        {&lt;br /&gt;
            string line;&lt;br /&gt;
            while ((line = sr.ReadLine()) != null)&lt;br /&gt;
            {&lt;br /&gt;
                Console.WriteLine(line);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Using streamreader to read the entire stream at once==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Collections.Specialized;&lt;br /&gt;
using System.IO;&lt;br /&gt;
using System.IO.rupression;&lt;br /&gt;
using System.Net;&lt;br /&gt;
using System.Net.Mail;&lt;br /&gt;
using System.Net.Sockets;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
public class MainClass&lt;br /&gt;
{&lt;br /&gt;
    public static void Main()&lt;br /&gt;
    {&lt;br /&gt;
   &lt;br /&gt;
        Stream s = new FileStream(&amp;quot;c:\\test.txt&amp;quot;, FileMode.Open);&lt;br /&gt;
        using (StreamReader sr = new StreamReader(s, Encoding.UTF8))&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(sr.ReadToEnd());&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>