Hi Eliot.
Thank you, but I think I have my smalltalk solution while the latest bzcat was running.
"Concatenate two streams" took a bit of hacking and study....
its easy now that I see it..
I extended the OSPipe upToEnd with...
upToEnd: aString
"Answer the remaining elements in the string. This method is retained for backward
compatibility with older versions of CommandShell."
| strm s |
strm := WriteStream on: ''.
strm nextPutAll: aString.
[(s := self next: 2000) isEmpty
ifTrue: [^ strm contents]
ifFalse: [strm nextPutAll: s]] repeat
All I did is pass in the string I needed to prepend
|pipe |
Transcript clear.
pipe := UnixProcess bzcatAFileToPipe.
Transcript show:(pipe upToEnd: '<?xml version="1.0" encoding="UTF-8"?>').
and it works.
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
<book category="WEB">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>
<year>2003</year>
<price>49.99</price>
</book>
<book category="WEB">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>
<year>2003</year>
<price>39.95</price>
</book>
</bookstore>
I spent some time fighting
| strm s |
strm := WriteStream on: '<?xml version="1.0" encoding="UTF-8"?>'.
[(s := self next: 2000) isEmpty
ifTrue: [^ strm contents]
ifFalse: [strm nextPutAll: s]] repeat
but the <?xml version="1.0" encoding="UTF-8"?> kept getting erased from the strm.
no biggy, it works now, that's all that matters.
Also, I was returning one of the Reader or Writer from the OSPipe when I could have just returned the whole pipe...
next up is seeing how that works on the big file I have.
thx for the c- possibility should I need it.
cordially.