BufferedStream implementation for .NET CF

  • Thread starter Thread starter www.msmobiles.com
  • Start date Start date
W

www.msmobiles.com

..NET CF has no BufferedStream. Has anybody made an
implemention of this class for .NET CF?
 
In most cases you can get away without it by using either
FileStream or MemoryStream. What're you trying to do?

-Alex
 
Alex Yakhnin said:
In most cases you can get away without it by using either
FileStream or MemoryStream. What're you trying to do?


I will try to use FileStream and test if it works and
come back here with results. Thanks.
 
Alex Yakhnin said:
In most cases you can get away without it by using either
FileStream or MemoryStream. What're you trying to do?

Originally I had:

Stream a_stream;
//... do something
BufferedStream s1 = new BufferedStream(in_stream);

.... but initialization with stream is not working with
file stream, thus this is not working:

FileStream s1 = new FileStream(a_stream);

.... because FileStream doesn't have such constructor!
And Stream is an abstract class.
So still I have the same problem: there is no
BufferedStream in .NET CF and there is nothing to replace
it with! Any ideas what to do?
 
The best way to proceed is to tell us *what* you want to do, rather than
*how* you want to do it. This will allow someone to suggest a good
alternative...

Paul T.
 
"Paul G. Tobey [eMVP]"
The best way to proceed is to tell us *what* you want to do, rather than
*how* you want to do it. This will allow someone to suggest a good
alternative...

I need this:

Stream a_stream;
//... do something
BufferedStream s1 = new BufferedStream(in_stream);

it is reading from stream through the buffered stream.
the input stream may be file or something else.

I cannot use FileStream because it has no constructor
with like FileStream(Stream something).

"Paul G. Tobey [eMVP]" - if you don't know, then don't
speak up! I cannot tell you everything about application
of course - don't be that naive. Are you another MVP that
posts hundreds of vague "tips" that are no help at all,
but just pretending? I need concrete help and concrete
answer, but I see that I am not going anywhere here. I
will have to hack it myself .....
 
That's still pretty much *how* you want to do it, not what or why. What's
wrong with just using the stream you already have without running it through
a buffered stream? What capability or functionality of the buffered stream
are you hoping to take advantage of?

Paul T.

www.msmobiles.com said:
"Paul G. Tobey [eMVP]"
The best way to proceed is to tell us *what* you want to do, rather than
*how* you want to do it. This will allow someone to suggest a good
alternative...

I need this:

Stream a_stream;
//... do something
BufferedStream s1 = new BufferedStream(in_stream);

it is reading from stream through the buffered stream.
the input stream may be file or something else.

I cannot use FileStream because it has no constructor
with like FileStream(Stream something).

"Paul G. Tobey [eMVP]" - if you don't know, then don't
speak up! I cannot tell you everything about application
of course - don't be that naive. Are you another MVP that
posts hundreds of vague "tips" that are no help at all,
but just pretending? I need concrete help and concrete
answer, but I see that I am not going anywhere here. I
will have to hack it myself .....
 
I process 10-15MB text files on the Pocket PC with code like this:


Imports System.IO

Private Sub ReadTextFile(ByVal sFilename As String)

Dim Reader As StreamReader

Try
' Ensure that the creation of the new StreamReader is wrapped in a
' Try-Catch block, since an invalid filename could have been used.
Reader = New StreamReader(sFilename)

' Read and display the lines from the file until the end
' of the file is reached.
Do
sLine = Reader.ReadLine()

If sLine Is Nothing Then Exit Do ' end of file
If sLine.Length = 0 Then GoTo Skip ' empty line

TextBoxPreview.Text = sLine
Skip:
Loop
Catch exc As Exception
' Show the exception to the user.
MessageBox.Show(exc.Message, "Error!")
Finally
' Close the object if it has been created.
If Not Reader Is Nothing Then
Reader.Close()
End If
End Try

End Sub
 
Back
Top