473,406 Members | 2,705 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,406 software developers and data experts.

FileStream to MemoryStream

Hi there,

I need to know what is the fastest way to copy a 9mb FileStream into a
MemoryStream?

Must I read a big buffer then writting it in my MemoryStream or is it a
better way?

Thank you

Jul 21 '05 #1
2 5337
Michel Racicot <mi*********************@cgi.com> wrote:
I need to know what is the fastest way to copy a 9mb FileStream into a
MemoryStream?

Must I read a big buffer then writting it in my MemoryStream or is it a
better way?


Well, I don't know about "big" - a 32K buffer would be plenty, I'd
think. You might get *slightly* faster performance with a larger
buffer, but 32K would be fine.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Cor
Hi Michel,

Yes you have to write it in a buffer(a byte array with the size of your
file)

And than construct the memory stream using that byte array

I hope this helps,

Cor
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Toby Mathews | last post by:
Hi, In an ASP.Net application I want to convert open create a FileStream object from a System.Drawing.Image - is this possible? I create an instance of an Image object using the FromFile method,...
4
by: Kai Bohli | last post by:
Hi all ! This message has been posted on .net.general, but I reposts it here due to lack of replies. This is my first day with Visual Studio and C#, and I'm trying to send "raw data" to the...
5
by: Chris Fink | last post by:
How do I load a string into a FileStream without going to disk? For example, string abc = "This is a string"; How do I load abc into a FileStream? FileStream input = new FileStream(.....);
9
by: Tim | last post by:
Hi, I have a list of products in with images stored in a SQL Server 2000 DB. I need to be able to retrieve the images when a product is chose. I use the code below to get the image from the DB...
3
by: sbparsons | last post by:
I have a file opened as a FileStream. I have a StreamReader and StreamWriter object opened, referencing the FileStream object. My aim is to read lines from the file until I find the line where...
1
by: Michel Racicot | last post by:
Hi there, I need to know what is the fastest way to copy a 9mb FileStream into a MemoryStream? Must I read a big buffer then writting it in my MemoryStream or is it a better way? Thank you
1
by: pgmfan | last post by:
What is the difference among filestream, memoryStream and byte stream, how do i use each properly. i confused by them appreciate for any advice ,please help
1
by: ad | last post by:
I do know how to convert a FileStream to MemoryStream. Could somebody help me?
3
by: paradigmshift | last post by:
I am looking at how to move data from a file to a memory stream. This data will be needed many times over and over so i don't want to have to rely on the system to keep the information cashed for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.