Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!unido!laura!exunido!baumeist From: baumeist@exunido.uucp (Hubert Baumeister) Newsgroups: comp.lang.smalltalk Subject: Re: Using ParcPlace ST80 2.5 BOSS and UDP UnixSocketAccessors Message-ID: <2437@laura.UUCP> Date: 11 Sep 90 13:50:08 GMT References: <25833@boulder.Colorado.EDU> Sender: news@laura.UUCP Reply-To: baumeist@exunido.UUCP (Hubert Baumeister) Organization: University of Dortmund, W-Germany Lines: 44 In article <25833@boulder.Colorado.EDU> chase@boulder.Colorado.EDU (Chase Turner) writes: > ... To my suprise, I've found that I cannot encode simple >objects using BinaryStorage -- or even with AsciiBinaryStorage. ... >-----detailed description follows-------- >Subject: >AsciiBinaryStorage unable to encode an instance of Time. This is not true. Both AsciiBinaryStorage and BinaryStorage function properly as you can see when using | ws | ws _ '' writeStream. (AsciiBinaryStorage write: ws) nextPut: Time now. ws contents The bug is in one of your classes: StreamBufferedUDPSocketAccessor>stream support print: aCollection ^stream nextPutAll: aCollection the semantics of print: anObject (as can be found in class Stream) is to store a printable description of an object on a stream, so it should read print: anObject ^anObject printOn: self >Also: >I want to replace AsciiBinaryStorage with BinaryStorage for more efficient encoding. However, doing so results in another error -- the inability of the ByteString buffer to accept integer bytes. This is a consequence of the BinaryStorage attempting to c >onvert all characters to integers and storing on the ReadWriteStream' ByteString collection....what is the alternative? Should I create a subclass of ByteString which will accept integers? Or, if I utilize a ByteArray, I cannot use accessor at:put: >ould I therefore subclass ByteArray and override it's error message? >Or, if I am to use UninterpertedBytes, how am I to make methods next, nextPut: nextPutAll? In connection with BOSS there is no problem. If you take AsciiBinaryStorage, than you have to use a stream on a string and if you use BinaryStorage you have to use a stream on a byte array. The message at:put: can be used with instances of class String and with instances of class ByteArray. In the case of a string the object has to be a character and in the case of an byte array the object has to be a byte. If you now upfront that you would like to put bytes than you can use byteAt:put: with strings and with byte arrays. Hubert (Hubert Baumeister huba@ls5.informatik.uni-dortmund.de)