For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > June 2007 > Re: Streaming [Re: Saving Image from remote location to local directory]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Streaming [Re: Saving Image from remote location to local directory]
Paolo Bonzini

2007-06-06, 7:22 pm


> 1) If you want to get serious with this, it would probably be good to
> replace the shared queue with some sort of shared, fixed size, circular
> buffer to prevent one process from generating a huge intermediate queue
> without letting the next one consume it. That should help with the flow
> through the pipeline. Ideally the buffer would also be fully polymorphic
> with streams, so that you can use the full arsenal, including
> #next:into:startingAt:, nextAvailable: and such.


In fact, this is what I implemented a while ago (remember the
PipeStream thread about turning a ReadStream decorator into a
WriteStream decorator?)

The PipeStream is a circular buffer, with the writer using #nextPut:
and the reader using #next.

Here is how it is used to turn the ReadStream decorator
(DeflateStream) into a WriteStream decorator. The user wants to write
uncompressed data with #nextPut:, but get deflated data when they send
#contents.

- the DeflateStream reads the data from the read side of the
PipeStream, and its #next method returns decorated data; it is not
visible to the user

- the PipeStream forks a process that reads the decorated data off the
DeflateStream and writes it on the write stream.

- the user sees the PipeStream as the decorator for its write stream,
since they will be able to use its write side.

- #contents uses a Promise object so that the connection process can
finish the compression

decorate: writeStream with: class
"A LazyPromise is the same as a Promise but with #value redefined
as `^super value value'. The idea is that #value: receives a
block,
which is quite expensive to evaluate -- so we have to delay it
until
the user actually asks for the value."
contents := LazyPromise new.
[
| readStream |
readStream := class on: self.
[
"This blocks the reader process if the buffer is empty."
writeStream nextPutAll: readStream nextHunk.

"Exit if they send #close to the PipeStream"
self isConnected and: [ readStream atEnd not ] ] whileTrue.

writeStream nextPutAll: readStream.

"Don't evaluate unless requested."
contents value: [ writeStream contents ] ] fork

contents
^contents value

Tardtendicker91

2007-06-10, 1:08 am

Shania Twain In Thong Shows Butt!
http://www.britneyraped.com/WatchMovie?vid=1673286

Jennifer Lopez Wired pussy!
http://www.britneyraped.com/e?q=1673286

Catherine Z. Jones Spreading Juicy Pussy Outdoor!
http://www.britneyraped.com/player?vid=1673286

Carmen Electra getting XXXXed!
http://www.britneyraped.com/Watch?watch=1673286

Halle Berry Fingered Pussy For Orgasm At Home!
http://www.britneyraped.com/Play?q=1673286

free japanese sex movie hard asian sex amateur sex video asian sex thumb black sex gallery
http://pwkktxik.t35.com/free-sex/fr...-sex-video.html http://az818p0w.t35.com/lesbian-sex...esbian-sex.html http://jrkrmu4j.t35.com/asian-sex/asian-sex-pic.html http://bfaqolfz.t35.com/black-sex/black-pussy-sex.html http://r3hdrcs8.t35.com/dor/debt-ma...redit-card.html
Tedtard51

2007-06-16, 3:56 pm

Carmen Electra Nude Shows Tits & Tight Ass At Home!

http://www.britneyraped.com/PlayMovie.cgi?q=1673286



funny cat video download funny video clip free sexy funny video clip funny soccer football video funny cat video
http://635-funny-video.info/funny-a...video-clip.html http://635-funny-video.info/funny-dog-video-clip.html http://635-funny-video.info/funny-music-video-clip.html http://635-funny-video.info/funny-animal-video.html http://635-funny-video.info/funny-bush-video.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com