diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-03-25 18:35:42 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-03-25 18:52:54 +0200 |
commit | 7b43f3eed2aac68e46edda2506e5be012ed76546 (patch) | |
tree | 3bce7b9a93cdc8c19d19b1408cd93bf78935ed6b /Messages.st | |
parent | 73f8b9a05cc3d40169877f450b943db340cf7653 (diff) |
streams: IEMessage is now working on streams all the way.zecke/use-streams
Diffstat (limited to 'Messages.st')
-rw-r--r-- | Messages.st | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Messages.st b/Messages.st index a85d940..82d4bfc 100644 --- a/Messages.st +++ b/Messages.st @@ -68,15 +68,12 @@ Object subclass: IEMessage [ ^ Exception signal: 'Unsupported IE type: ', type asString. ] - IEMessage class >> decode: aByteArray with: aIEBase [ - | msg dat | - msg := IEMessage initWith: (aByteArray at: 1). - - dat := aByteArray copyFrom: 2. - [dat isEmpty not] whileTrue: [ - | consumed | - consumed := self findIE: dat readStream from: aIEBase on: msg. - dat := dat copyFrom: consumed + 1. + IEMessage class >> decode: aStream with: aIEBase [ + | msg | + msg := IEMessage initWith: aStream next. + + [aStream atEnd] whileFalse: [ + self findIE: aStream from: aIEBase on: msg. ]. ^ msg |