Click here to Skip to main content
15,914,905 members
Home / Discussions / C#
   

C#

 
Questionstream? how does it work? Pin
Snowjim27-Apr-05 12:26
Snowjim27-Apr-05 12:26 
AnswerRe: stream? how does it work? Pin
Dave Kreskowiak27-Apr-05 16:28
mveDave Kreskowiak27-Apr-05 16:28 
GeneralRe: stream? how does it work? Pin
Snowjim27-Apr-05 22:44
Snowjim27-Apr-05 22:44 
GeneralRe: stream? how does it work? Pin
turbochimp28-Apr-05 3:35
turbochimp28-Apr-05 3:35 
GeneralRe: stream? how does it work? Pin
Snowjim28-Apr-05 6:47
Snowjim28-Apr-05 6:47 
GeneralRe: stream? how does it work? Pin
turbochimp28-Apr-05 7:22
turbochimp28-Apr-05 7:22 
GeneralRe: stream? how does it work? Pin
Snowjim28-Apr-05 7:31
Snowjim28-Apr-05 7:31 
GeneralRe: stream? how does it work? Pin
turbochimp28-Apr-05 7:46
turbochimp28-Apr-05 7:46 
As you have no-doubt discovered, storing an ArrayList of bytes is not a good idea (at least with the goal of reinventing a Stream).

Flush does not cause all the data to disappear. It ensures that any bytes in the buffer are written to some device (at least that's the principal, although inheritors of Stream are free to implement it as they wish). In the case of MemoryStream, Flush is overridden to do nothing at all, since there is no known "device".

You're right. I don't know of any way to arbitrarily delete bytes in a stream, but as I suggested, you could just lock the stream, read the bytes you want to save from the stream (those not already read by the client) into a local byte[], then reinitialize the stream with those bytes and synchronize the reader and writer with the new position, length etc.


The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

GeneralAPI commands Pin
c00lguy27-Apr-05 12:13
c00lguy27-Apr-05 12:13 
GeneralRe: API commands Pin
Dave Kreskowiak27-Apr-05 16:22
mveDave Kreskowiak27-Apr-05 16:22 
GeneralRe: API commands Pin
c00lguy28-Apr-05 1:12
c00lguy28-Apr-05 1:12 
QuestionWinForm problem please help? Pin
OnlyTaz27-Apr-05 10:40
OnlyTaz27-Apr-05 10:40 
AnswerRe: WinForm problem please help? Pin
Besinci27-Apr-05 14:43
Besinci27-Apr-05 14:43 
GeneralRe: WinForm problem please help? Pin
OnlyTaz27-Apr-05 14:56
OnlyTaz27-Apr-05 14:56 
GeneralRe: WinForm problem please help? Pin
Dave Kreskowiak27-Apr-05 16:19
mveDave Kreskowiak27-Apr-05 16:19 
Generalwinforms app to control browser Pin
fortyonejb27-Apr-05 10:09
fortyonejb27-Apr-05 10:09 
GeneralRe: winforms app to control browser Pin
MoustafaS27-Apr-05 10:18
MoustafaS27-Apr-05 10:18 
GeneralRe: winforms app to control browser Pin
fortyonejb27-Apr-05 15:50
fortyonejb27-Apr-05 15:50 
GeneralRe: winforms app to control browser Pin
Dave Kreskowiak27-Apr-05 16:17
mveDave Kreskowiak27-Apr-05 16:17 
GeneralRe: winforms app to control browser Pin
fortyonejb27-Apr-05 18:03
fortyonejb27-Apr-05 18:03 
GeneralRe: winforms app to control browser Pin
Carl Mercier28-Apr-05 2:06
Carl Mercier28-Apr-05 2:06 
GeneralRe: winforms app to control browser Pin
fortyonejb28-Apr-05 14:11
fortyonejb28-Apr-05 14:11 
GeneralAdding a key to the registry Pin
Anonymous27-Apr-05 10:02
Anonymous27-Apr-05 10:02 
GeneralRe: Adding a key to the registry Pin
Marc Clifton27-Apr-05 10:14
mvaMarc Clifton27-Apr-05 10:14 
GeneralRe: Adding a key to the registry Pin
MoustafaS27-Apr-05 10:20
MoustafaS27-Apr-05 10:20 

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.