473,396 Members | 1,891 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,396 software developers and data experts.

Stream not readable problem

hs
Hi

I got a 'stream not readable' exception. I'd appreciate if some one can tell
me how i can overcome this.

thanks
My Exception
--------------
An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.ArgumentException: Stream was not
readable.
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean
detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(Stream stream)
at WebService1.Service1.GetCompressedData() in
c:\inetpub\wwwroot\webservice1\service1.asmx.cs:li ne 114
--- End of inner exception stack trace ---

My code
---------
[WebMethod]
public string GetCompressedData()
{
TextReader textreader;
DataSet ds = new DataSet();

// populate dataset
....

byte[] bytes = System.Text.Encoding.UTF8.GetBytes(ds.GetXml());

// compress using
using(MemoryStream sourcestream = new MemoryStream(bytes))
{
MemoryStream destinationStream = new MemoryStream();
using (XceedCompressedStream xcs =
new
XceedCompressedStream(destinationStream))
{
byte[] buffer = new byte[ 32768 ];
int bytesRead = 0;

while( ( bytesRead = sourcestream.Read( buffer, 0, buffer.Length ) )
0 )

{
xcs.Write( buffer, 0, bytesRead );
}
}
textreader = new StreamReader(destinationStream); // **** line 114 ****
}
return textreader.ReadToEnd();
}
Nov 22 '05 #1
0 1153

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

Similar topics

11
by: Amey Samant | last post by:
hi all i was trying to read an integer from keyboard with DataInputStream can someone explain the behaviour of the following code ???? <code> DataInputStream dis=new...
0
by: hs | last post by:
Hi I got a 'stream not readable' exception. I'd appreciate if some one can tell me how i can overcome this. thanks My Exception --------------
2
by: stephen fx | last post by:
Hello all! Using C/C++ I can do this: struct MyStruct { int a; char b; }; MyStruct test;
2
by: ce | last post by:
Being a newbie regarding serialization and memorystreams, I was trying to see if i could improve page performance (avoiding going to the db on a postback) by saving my serialized business object in...
2
by: mag | last post by:
Let's start off by saying I'm a noob to .Net but here's my problem. I have many files, all with the same structure. I know the structure, It was written in some version of C++. Because it seem...
2
by: Feng | last post by:
Hi, I need a VB.Net function that reads in a stream of binary data coming in from a legacy data source. The data are actually hex numbers in binary format but the problem is that I don't know...
3
by: sven.suursoho | last post by:
Hello, In main(), the first output API is what I try to achieve. Unfortunately it fails, printing first string as pointer instead of human readable message. Tried to initialize str(""), set new...
1
by: Michael | last post by:
I have a solution for this, but it feels wrong. If anyone could offer a better one, I'm all ears. (Or technically, eyes.) Basically, I have a bunch of classes. For concreteness, one is a...
2
by: DBuss | last post by:
OK, I'm reading a multicast socket. It attaches fine, reads fine, all of that. The problem is that while some of the data I get is normal text (ASCII String), some of it is Binary Integer. ...
3
by: somebody | last post by:
Hi all, I have been working on a php script lately that merges results from a db and an xml source and then populates a PDF through FDF. I have gotten nearly everything to work except multi line...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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...

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.