For examples and more explanations, see the module level docs.
An instance of this class is a read file adaptor component. It's constructor arguments are all optional. If no arguments are provided, then the default is to read from stdin, one line at a time, as fast as possible. Note that this will cause the outbox to fill at the same rate as stdin can provide data. (Be wary of memory constraints this will cause!)
After setting the ReadFileAdaptor in motion, you can then hook it into your linkages like any other component.
Methods defined here
__init__(self[, filename][, command][, readmode][, readsize][, steptime][, bitrate][, chunkrate][, debug])
Standard constructor, see class docs for details
#!!!! Called at component exit... Closes the file handle
This method attempts to read data of a specific block size from the file handle. If null, the file is EOF. This method is never called directly. If the readmode is block or bitrate, then the attribute self.getData is set to this function, and then this function is called using self.getData(). The reason for this indirection is to make it so that the check for which readmode we are in is done once, and once only
This method attempts to read a line of data from the file handle. If null, the file is EOF. As with getDataByteLen, this method is never called directly. If the readmode is readline (or ""), then the attribute self.getData is set to this function, and then this function is called using self.getData(). Same reason for indirection as above.
Opens the appropriate file handle
We check whether it's time to perform a new read, if it is, we read some data. If we get some data, we put it in out outbox "outbox", and to stdout (if debugging). If we had an error state (eg EOF), we return 0, stopping this component, otherwise we return 1 to live for another line/block.
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.