Click here to Skip to main content
15,920,708 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is this how MemoryStreams works? Pin
Steven Campbell19-Apr-05 6:42
Steven Campbell19-Apr-05 6:42 
QuestionWriting and Reading on MemoryStream? Pin
Snowjim18-Apr-05 23:57
Snowjim18-Apr-05 23:57 
AnswerRe: Writing and Reading on MemoryStream? Pin
leppie19-Apr-05 5:13
leppie19-Apr-05 5:13 
GeneralRe: Writing and Reading on MemoryStream? Pin
Snowjim19-Apr-05 5:28
Snowjim19-Apr-05 5:28 
GeneralRe: Writing and Reading on MemoryStream? Pin
Stefan Troschuetz19-Apr-05 8:43
Stefan Troschuetz19-Apr-05 8:43 
GeneralRe: Writing and Reading on MemoryStream? Pin
Stefan Troschuetz19-Apr-05 8:44
Stefan Troschuetz19-Apr-05 8:44 
GeneralRe: Writing and Reading on MemoryStream? Pin
Snowjim19-Apr-05 9:03
Snowjim19-Apr-05 9:03 
GeneralRe: Writing and Reading on MemoryStream? Pin
Stefan Troschuetz19-Apr-05 9:12
Stefan Troschuetz19-Apr-05 9:12 
GeneralRe: Writing and Reading on MemoryStream? Pin
Scott Serl19-Apr-05 9:40
Scott Serl19-Apr-05 9:40 
GeneralRe: Writing and Reading on MemoryStream? Pin
Snowjim19-Apr-05 10:16
Snowjim19-Apr-05 10:16 
GeneralRe: Writing and Reading on MemoryStream? Pin
Scott Serl19-Apr-05 11:35
Scott Serl19-Apr-05 11:35 
GeneralRe: Writing and Reading on MemoryStream? Pin
Snowjim20-Apr-05 3:50
Snowjim20-Apr-05 3:50 
GeneralRe: Writing and Reading on MemoryStream? Pin
Scott Serl20-Apr-05 8:29
Scott Serl20-Apr-05 8:29 
GeneralRe: Writing and Reading on MemoryStream? Pin
Snowjim20-Apr-05 8:40
Snowjim20-Apr-05 8:40 
GeneralRe: Writing and Reading on MemoryStream? Pin
Scott Serl20-Apr-05 11:04
Scott Serl20-Apr-05 11:04 
GeneralRe: Writing and Reading on MemoryStream? Pin
Snowjim20-Apr-05 11:42
Snowjim20-Apr-05 11:42 
This is very good info!

I have tryed some more.

And right now i have built in an ArrayList in my Stream.

When adding a byte i am using
<br />
StreamCollection.Add(value); //this is the ArrayList thats add byte to it<br />
OnReceivedData(new EventArgs()); //this is an event<br />


and when a unit is reading i am using :
<br />
int tmpData = (int)((byte)StreamCollection[0]);<br />
StreamCollection.RemoveAt(0);<br />
return tmpData;<br />


Maby this is a slow way to handle it?

2. Use a short list of byte arrays for the stream. When your write would go past the end of the array, create a new array (or manage a pool of existing arrays) to put the overflow in. Add the new array to a collection. When you read the past the end of an array, you can remove it from the collection.


I started with this but then i thougt that it maby was the same speed if i just place the bytes in the ArrayList?

Or will 2# be faster?

If i have got this 2# right
Then i first need a collection(ArrayList)
int this Collection i will store smal byte arrays like byte[128] or somthing like that.
Then when i have i howl byte buffert(byte[128]) full then i will have to create a new byte array that i write to and place this on the second place in the Collection.

When the reader have readed the first byte buffert in the collection it will be removed
Collection.removeat(0); and then it will begin read on the next byte array.

Will this realy be faster then just adding the bytes to the ArrayList?

Its important that you can work against this stream as any regular stream. It is posible that it will be connected to controls that reads from streams. Will this be posible if I maintain the override funktion of Stream? like WriteByte(), ReadByte(); and so on?

Best Regards
Jimmy
GeneralRe: Writing and Reading on MemoryStream? Pin
Scott Serl21-Apr-05 8:22
Scott Serl21-Apr-05 8:22 
GeneralCrystalReports From Pull -&gt; Push Pin
V.18-Apr-05 23:49
professionalV.18-Apr-05 23:49 
GeneralFilling the Textbox Pin
Anonymous18-Apr-05 23:36
Anonymous18-Apr-05 23:36 
Generalplease help me with this Pin
snouto18-Apr-05 23:28
snouto18-Apr-05 23:28 
GeneralRe: please help me with this Pin
S. Senthil Kumar19-Apr-05 0:52
S. Senthil Kumar19-Apr-05 0:52 
GeneralTransparent ListBoxes Pin
zagzagzag18-Apr-05 23:24
zagzagzag18-Apr-05 23:24 
GeneralRe: Transparent ListBoxes Pin
Anonymous19-Apr-05 1:05
Anonymous19-Apr-05 1:05 
GeneralRe: Transparent ListBoxes Pin
Dave Kreskowiak19-Apr-05 4:19
mveDave Kreskowiak19-Apr-05 4:19 
GeneralRe: Transparent ListBoxes Pin
zagzagzag19-Apr-05 9:10
zagzagzag19-Apr-05 9:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.