Package core :: Module streams :: Class WriteStream |
[hide private]
[frames] | no frames]

# Class WriteStream

source code

    object --+
             |
            WriteStream

Known Subclasses:
  - sock_js.SockJSSocket
  - , net.NetSocket
  - , file_system.AsyncFileWriteStream
  - , http.HttpClientRequest
  - , http.HttpServerResponse
  - , http.WebSocket

A mixin module which represents a stream of data that can be written to.

Any class that mixes in this module can be used by a to pump data from a to it.

Instance Methods | [hide private]
write_buffer(self, buff) Write some data to the stream. | source code
set_write_queue_max_size(self, size) Set the maximum size of the write queue. | source code
write_queue_full(self) Is the write queue full? | source code
drain_handler(self, handler) Set a drain handler on the stream. | source code
exception_handler(self, handler) Set an execption handler on the stream. | source code
_to_write_stream(self) | source code

Class Variables | [hide private]
| write_queue_max_size = `property(fset= set_write_queue_max_size)`

Method Details | [hide private]

### write_buffer(self, buff) | source code
Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the method before writing. This is done automatically if using a . param [Buffer]. The buffer to write.

### set_write_queue_max_size(self, size) | source code
Set the maximum size of the write queue. You will still be able to write to the stream even if there is more data than this in the write queue. This is used as an indicator by classes such as to provide flow control. Keyword arguments: Parameters: `size` - The maximum size, in bytes.

### write_queue_full(self) | source code
Is the write queue full? return True if there are more bytes in the write queue than the max write queue size. Decorators: `@property`

### drain_handler(self, handler) | source code
Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue has been reduced to maxSize / 2. See for an example of this being used. Keyword arguments: Parameters: `handler` - The drain handler

### exception_handler(self, handler) | source code
Set an execption handler on the stream. Keyword arguments: Parameters: `handler` - The exception handler