473,704 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

perhaps I just don't understand streams as well as I should...

Okay, maybe I'm trying to use streams in some unacceptable way, but I'm
running into a few problems.

I need to be able to serialize a set of data and deserialize it in
another place. It seems kind of pointless in one app, but since data
could come remotely, it's easiest to always serialize and deserialize in
the same place.

At the moment, I'm having trouble moving streams around. I need to be
able to have an object point to a stream for handling serializing an
object, and another object point to the same stream for deserializing
the object (at the moment, this is all proof-of-concept stuff).

Unfortunately, if I try and deserialize off of the same stream, I keep
getting errors about reading from the end of the stream. I understand
why that would happen, since the stream has written and is now at the
end of the stream. What I don't understand is how to deal with this.

Lee Crabtree
Feb 20 '06 #1
2 1182
Lee,

After serializing into the stream revert the stream pointer.

You can do that eather useing the Position proeprty or using the Seek
method. Some of the streams cannot be sought; these are usually the streams
for net resources. If you now nothing about the stream you should check the
CanSeek property.
--
HTH
Stoitcho Goutsev (100)

"Lee Crabtree" <lc*******@gois i.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Okay, maybe I'm trying to use streams in some unacceptable way, but I'm
running into a few problems.

I need to be able to serialize a set of data and deserialize it in another
place. It seems kind of pointless in one app, but since data could come
remotely, it's easiest to always serialize and deserialize in the same
place.

At the moment, I'm having trouble moving streams around. I need to be
able to have an object point to a stream for handling serializing an
object, and another object point to the same stream for deserializing the
object (at the moment, this is all proof-of-concept stuff).

Unfortunately, if I try and deserialize off of the same stream, I keep
getting errors about reading from the end of the stream. I understand why
that would happen, since the stream has written and is now at the end of
the stream. What I don't understand is how to deal with this.

Lee Crabtree

Feb 20 '06 #2
Okay, that's what I found initially, but I wasn't sure if there was a
better way to go about it all. Thanks.

Lee Crabtree

Stoitcho Goutsev (100) wrote:
Lee,

After serializing into the stream revert the stream pointer.

You can do that eather useing the Position proeprty or using the Seek
method. Some of the streams cannot be sought; these are usually the streams
for net resources. If you now nothing about the stream you should check the
CanSeek property.

Feb 20 '06 #3

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

Similar topics

5
10160
by: Alligator | last post by:
And more specifically what is the difference between an InputStream and a BufferedInputStream? When should I use one and when should I use the other? And why is there besides a BufferedInputStream also a Buffered Reader? Should one use ?? : InputStreamReader r = new InputStreamReader( blabla.getInputStream()); or
303
17661
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
3
2285
by: sb | last post by:
I think streams are nice, but what do you do when you have to write to or, even worse, read from a FILE*, for example a UNIX stream? C++ streams can not be created from FILE*'s or have them attached. Today, a C++ programmer has to decide beforehand whether he wants to use C or C++ I/O. Suppose you choose C++ streams and write all of the "operator>>" code for your objects. If you later decide to read the same objects from a UNIX pipe,...
10
1617
by: perryche | last post by:
Experts, I have the following scenario: Table1: RecordID RecordDate ... I want in a query to show me within this RecordID, only the latest RecordDate and info. I know I can use the Max command but am not familiar with the concept behind it, how to use it. i.e. if I pick Max(RecordDate) in the query column, it still shows all records. If I combine it with RecordID, same... what should I have done?
41
4306
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
9
3205
by: Carsten H. Pedersen | last post by:
Hello. Having an issue with double streams... for a lack of a better name. :) I have the following two streams: - FooInputStream, fis, extending InputStream - FooOutputStream, fos, extending OutputStream These each have a piped stream as a local variable, so: - fos has a PipedOutputStream, pos
11
2593
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating temperatures. T = 20 degrees at all times.... The 2D T-array looks like this:
85
4294
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the offending index are. Why does it force you to determine that information for yourself when it could save you a step and just tell you? This seems like a "no-brainer" to me. Am I missing something?
34
1788
by: raphfrk | last post by:
This program should copy one file onto the other. It works if I compile it with gcc to a cygwin program. However, if I compile it with the -mno-cygwin option, it doesn't work (this targets native windows). Anyway, I just want to check that the program is valid before I see if I can find a way around a compiler bug. It might be something simple that I am doing wrong.
0
9272
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8977
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6605
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5931
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4439
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4701
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2483
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2080
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.