`
sjk2013
  • 浏览: 2186481 次
文章分类
社区版块
存档分类
最新评论

C# FileStream.Read Method

 
阅读更多

Reads a block of bytes from the stream and writes the data in a given buffer.

public override int Read(
	byte[] array,
	int offset,
	int count
)

Parameters

array
Type:System.Byte[]

When this method returns, contains the specified byte array with the values betweenoffsetand (offset+count- 1)replaced by the bytes read from the current source.

offset
Type:System.Int32

The byte offset inarrayat which the read bytes will be placed.

count
Type:System.Int32

The maximum number of bytes to read.

Return Value

Type:System.Int32
The total number of bytes read into the buffer. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached.
Exception Condition
ArgumentNullException

arrayisnull.

ArgumentOutOfRangeException

offsetorcountis negative.

NotSupportedException

The stream does not support reading.

IOException

An I/O error occurred.

ArgumentException

offsetandcountdescribe an invalid range inarray.

ObjectDisposedException

Methods were called after the stream was closed.


分享到:
评论

相关推荐

    C# FileStream 追加写入字符串到文本中

    C# FileStream 追加写入字符串到文本中 C# FileStream 追加写入字符串到文本中 C# FileStream 追加写入字符串到文本中 C# FileStream 追加写入字符串到文本中

    FileStream.Me - official Chrome extension-crx插件

    使用FileStream.Me服务下载链接 这个独特的应用程序通过使用FileStream.Me服务简化了您喜欢的音乐,电影和软件的下载。 我们的应用程序可帮助您发现可以使用FileStream.Me下载的链接。 只需单击一下,所选的链接就会...

    FileStream.Me - 官方的Chrome扩展「FileStream.Me - official Chrome extension」-crx插件

    使用FileStream.Me服务下载链接 这个独特的应用程序通过使用FileStream.Me服务简化了您喜欢的音乐,电影和软件的下载。 我们的应用程序可帮助您发现可以使用FileStream.Me下载的链接。 只需单击一下,所选的链接就会...

    生成系统日志

    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor...

    C# FileStream 分段读取文本内容

    C# FileStream 分段读取文本内容C# FileStream 分段读取文本内容C# FileStream 分段读取文本内容C# FileStream 分段读取文本内容

    C# FileStream文件读写详解

    FileStream对象表示在磁盘或网络路径上指向文件的流。这个类提供了在文件中读写字节的方法,但经常使用StreamReader或StreamWriter执行这些功能。这是因为FileStream类操作的是字节和字节数组,而Stream类操作的是...

    C#基础知识之FileStream

    一、FileStream的基础知识  属性:  CanRead 判断当前流是否支持读取,返回bool值,True表示可以读取  CanWrite 判断当前流是否支持写入,返回bool值,True表示可以写入  方法:  Read() 从流中读取数据,...

    C# FileStream 数据读写文本

    FileStream fs; //创建文件 Console.WriteLine("请输入创建的文件名,输入正确的路径"); string filename = Console.ReadLine().ToString(); try { fs = File.Create(filename); } catch (IOException ex) ...

    filestream读文件 c#

    filestream读文件 c# 初学者 很实用的的文件操作

    C# FileStream简单介绍和使用

    主要为大家详细介绍了C# FileStream基本功能和使用,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

    C#USBHID完整例程

    C#下USB的hid通信,例程中关于USB的hid类的通信,实现数据收发

    C# FileStream读写的文本操作代码分析

    主要分享了个人使用C# FileStream实现的读写的文本操作的小程序,主要是复习下对filestream的理解,希望对大家学习C#能够有所帮助

    C#读取中文文件出现乱码的解决方法

    本文实例讲述了C#读取中文文件出现乱码的解决方法。分享给大家供大家参考。具体分析如下: 先来看这段代码: FileStream aFile = new FileStream(SingleFile,FileMode.Open); StreamReader sr = new StreamReader(a...

    详解C# FileStream类

    C# FileStream类 在 C# 语言中文件读写流使用 FileStream 类来表示,FileStream 类主要用于文件的读写,不仅能读写普通的文本文件,还可以读取图像文件、声音文件等不同格式的文件。区别于File类的是它对文件可进行...

    C# 文本编辑器设计

    VS2005 C# 文本编辑器 public Form1() { InitializeComponent(); } private void 文件... fileStream.WriteLine("This is a test"); fileStream.WriteLine(richTextBox1.Text); fileStream.Close(); } }

    C#使用FileStream对象读写文件

    在项目开发中经常会涉及到对文件的读写,c# 提供了很多种方式来对文件进行读写操作,今天来说说FileStream 对象。 FileStream表示在磁盘或网络路径上指向文件的流。一般操作文件都习惯使用StreamReader 和 ...

    FileStream.SetAccessControl引发UnauthorizedAccessException :: File.SetAccessControl起作用

    太好了-谢谢Rick!我已经按照您的建议(如下所示)更新了我的代码,并且效果很好。 我没有尝试过此操作,因为我认为锁是文件流所拥有的,因此从其他对象访问文件会导致问题-否则很容易学习...

Global site tag (gtag.js) - Google Analytics