Hi Phil,
You are welcome.
Also thanks Jon and Sean for actively participating the community.
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!From: "Phil Jones" <
[email protected]>
!References: <
[email protected]>
<
[email protected]>
!Subject: Re: Dumping a [Stream] to a file.
!Date: Thu, 25 Sep 2003 16:42:03 +1200
!Lines: 76
!X-Priority: 3
!X-MSMail-Priority: Normal
!X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!Message-ID: <
[email protected]>
!Newsgroups: microsoft.public.dotnet.framework
!NNTP-Posting-Host: 210-246-0-68.paradise.net.nz 210.246.0.68
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:54675
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!Yes... I'm sussed here - thank you all.
!
!
!!> Hello Phil,
!>
!> Thanks for posting in the group.
!>
!> Jon is right. StreamReader is designed for character input in a
particular
!> encoding, whereas the Stream class is designed for byte input and output.
!> Use StreamReader for reading lines of information from a standard text
!> file. So if you are dumping a binary file, please use Stream class
!instead.
!>
!> Does that answer your question?
!>
!> Best regards,
!> Yanhong Huang
!> Microsoft Online Partner Support
!>
!> Get Secure! -
www.microsoft.com/security
!> This posting is provided "AS IS" with no warranties, and confers no
!rights.
!>
!> --------------------
!> !From: "Phil Jones" <
[email protected]>
!> !Subject: Dumping a [Stream] to a file.
!> !Date: Wed, 24 Sep 2003 20:59:30 +1200
!> !Lines: 30
!> !X-Priority: 3
!> !X-MSMail-Priority: Normal
!> !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
!> !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
!> !Message-ID: <
[email protected]>
!> !Newsgroups: microsoft.public.dotnet.framework
!> !NNTP-Posting-Host: 210-246-0-7.paradise.net.nz 210.246.0.7
!> !Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
!> !Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:54575
!> !X-Tomcat-NG: microsoft.public.dotnet.framework
!> !
!> !What's the best way to dump a sundry [Stream] into a file?
!> !
!> !At present I'm doing the following:
!> !
!> !******************
!> ! Dim target As New FileStream("C:\MyFile.bin", FileMode.CreateNew)
!> !
!> ! Dim source As Stream = getStreamMethod()
!> ! Dim reader As New StreamReader(source)
!> !
!> ! REM -- Copy the stream to the target.
!> ! Dim writer As New StreamWriter(target)
!> ! Do
!> ! writer.WriteLine(reader.ReadLine)
!> ! Loop Until reader.Peek = -1
!> ! writer.Flush()
!> !******************
!> !
!> !The problem is this:
!> !1) It breaks if the stream has different encodings (for example, with a
!GIF
!> !image I'm working with)
!> !2) This doesn't seem like a very efficient way to do something that must
!> !surely be quite a common task.
!> !
!> !Thanks anyone....
!> !---
!> !Phil
!> !
!> !
!> !
!> !
!>
!
!
!