Back: Sockets.RawSocketImpl class-parameters Up: Sockets package Forward: Sockets.ReadBuffer class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

6.17 Sockets.ReadBuffer

Defined in namespace Sockets
Superclass: ReadStream
Category: Examples-Useful tools

I'm a ReadStream that, when the end of the stream is reached, evaluates an user defined block to try to get some more data.

6.17.1 Sockets.ReadBuffer class: instance creation  (class)
6.17.2 Sockets.ReadBuffer: accessing-reading  (instance)
6.17.3 Sockets.ReadBuffer: buffer handling  (instance)


6.17.1 Sockets.ReadBuffer class: instance creation

on: aCollection
Answer a Stream that uses aCollection as a buffer. You should ensure that the fillBlock is set before the first operation, because the buffer will report that the data has ended until you set the fillBlock.


6.17.2 Sockets.ReadBuffer: accessing-reading

nextAvailable: anInteger into: aCollection startingAt: pos
Place the next anInteger objects from the receiver into aCollection, starting at position pos. Return the number of items stored.

nextAvailable: anInteger putAllOn: aStream
Copy the next anInteger objects from the receiver to aStream. Return the number of items stored.


6.17.3 Sockets.ReadBuffer: buffer handling

atEnd
Answer whether the data stream has ended.

availableBytes
Answer how many bytes are available in the buffer.

bufferContents
Answer the data that is in the buffer, and empty it.

fill
Fill the buffer with more data if it is empty, and answer true if the fill block was able to read more data.

fillBlock: block
Set the block that fills the buffer. It receives a collection and the number of bytes to fill in it, and must return the number of bytes actually read

isEmpty
Answer whether the next input operation will force a buffer fill

isFull
Answer whether the buffer has been just filled

notEmpty
Check whether the next input operation will force a buffer fill and answer true if it will not.

pastEnd
Try to fill the buffer if the data stream has ended.



Back: Sockets.ReadBuffer-accessing-reading Up: Sockets.ReadBuffer Forward: Sockets.ServerSocket   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html