English 中文(简体)
简化C#的实施
原标题:Streams implementation in C#

What do I have to do to implement my own stream, which uses custom compression routine, similiar to, for example, GZipStream?

我显然不得不将<代码>Stream类别分类,但我应当执行哪些方法,哪些方法可以留待执行?

基本上说来,文件有特殊部分,,但可能有一个更好和更容易的选择?

执行机构的说明

When implementing a derived class of Stream, you must provide implementations for the Read and Write methods. The asynchronous methods BeginRead, EndRead, BeginWrite, and EndWrite are implemented through the synchronous methods Read and Write. Similarly, your implementations of Read and Write will work correctly with the asynchronous methods. The default implementations of ReadByte and WriteByte create a new single-element byte array, and then call your implementations of Read and Write. When deriving from Stream, if you have an internal byte buffer, it is strongly recommended that you override these methods to access your internal buffer for substantially better performance. You must also provide implementations of CanRead, CanSeek, CanWrite, Flush, Length, Position, Seek, and SetLength.

Do not override the Close method, instead, put all of the Stream cleanup logic in the Dispose method. For more information, see Implementing a Dispose Method.

最佳回答

www.un.org/Depts/DGACM/index_french.htm 在你完成全部工作之前,它不会汇编。 但是,允许您提交<代码>NotSupportedException,例如,如果您返回false,,则允许Seek()。 同样,如果贵国的行文仅读到(false>>>>,则该行可从上 throw。

事实上,就象这样的复杂情况而言,我期望你最终推翻大多数(非日本)的APIC。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...