#BUGFIX by stefan
class: NonPositionableExternalStream
changed: #nextLine
fix for binary streams
--- a/NonPositionableExternalStream.st Thu Jul 07 17:26:59 2016 +0200
+++ b/NonPositionableExternalStream.st Thu Jul 07 17:39:56 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -587,21 +589,26 @@
so it's possible to read alien (i.e. ms-dos) text as well.
Redefined to not block forever if no cr is read."
- |answerStream char available "{ Class:SmallInteger }"|
+ |answerStream char available "{ Class:SmallInteger }" wasBinary|
answerStream := WriteStream on:(String uninitializedNew:80).
[
available := self numAvailableForRead.
+ wasBinary := binary. "temporarily set to text mode"
+ binary := false.
available timesRepeat:[
- char := super next. "we know that there is data"
+ char := super next. "we know that there is data"
char == Character cr ifTrue:[
(answerStream size ~~ 0 and:[answerStream last == Character return]) ifTrue:[
answerStream backStep.
].
+ binary := wasBinary.
^ answerStream contents.
].
answerStream nextPut:char.
].
+ binary := wasBinary. "restore saved mode"
+
"#atEnd waits for new data or EOF"
self atEnd ifTrue:[
answerStream size == 0 ifTrue:[