473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Stream Reader And Buffer

12
I have written the following function
Expand|Select|Wrap|Line Numbers
  1.         Public Function ReadFile(ByVal FileName As String) As String
  2.             Dim objReader As StreamReader = Nothing
  3.             Dim objData As New StringBuilder
  4.             Dim strReturn As String = ""
  5.             Try
  6.                 objReader = New StreamReader(FileName, Encoding.Default, True, 512)
  7.                 objData.Append(objReader.ReadToEnd)
  8.                 strReturn = objData.ToString
  9.             Catch Ex As Exception
  10.                 objReader.Dispose()
  11.                 strReturn = Ex.Message
  12.             Finally
  13.                 objReader.Dispose()
  14.             End Try
  15.             Return strReturn
  16.         End Function
  17.  
When i am creating the streamreader I have specified of 512 (I presume thats bytes) for the buffer. Thats fine but i am also given the option when reading from the stream reader to .Read(Buffer,Index, Count) what is the difference between the two buffer sizes?

Cheers
Feb 9 '08 #1
0 897

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents...
4
by: seema_coma | last post by:
I am working under a Linux environment, and I want to "read stream up to next delimiter". It looks like linux doesnt't have a function such as bgets() All i need is, reading characters from...
2
by: Daniel Goldman | last post by:
Hi, Any advice about both a BinaryReader and BinaryWriter containing same FileStream at same time? Like: Stream fs = new FileStream("output.dbf", FileMode.Create); BinaryReader br = new...
8
by: Scott | last post by:
Hi guys, If I try to call read(), readline(), readtoend() and there is nothing to read (from a never ending loop for example) the program seems to continue but it exits the loop for no apparent...
3
by: DC | last post by:
Hi, I am trying to load a pdf file into a memorystream and upload this file to the browser. However, wenn I run the attached code (the ftpStream is a valid stream of the pdf file) I receive an...
7
by: semedao | last post by:
Hi, I am using cryptostream on both sides on tcp connection that pass data. I am also use asyc socket , so , the data that recieved in the callback method not always have the length of the buffer...
10
by: John Kraft | last post by:
Hello all, I'm experiencing some, imo, strange behavior with the StreamReader object I am using in the code below. Summary is that I am downloading a file from a website and saving it to disk...
0
by: zee | last post by:
All, I have used this code for the past 3-4 years and never had any problem with any version of .NET or Adobe Reader. It is supposed to open a PDF in a new browser window. I copied this...
2
by: Jack | last post by:
Hi, I want to read a string a chars from a stream, and put it into a string. At the moment, I'm creating a buffer of a fixed size, and reading the stream of text into it. It works, but I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.