#ifndef JS_STREAM_H #define JS_STREAM_H /* Stream object Abstract object that is intended to provide a base API for streams, be they a socket, a file, a directory, or whatever. Basically this is like an interface. interface Stream { public: //Open the stream void open() //Close the stream void close() //Read a line string read() //Read len bytes string read(int len) //Read a single character string readChar() //Seek to a stream position void seek(int pos, int base_point) //Get the number of bytes available for reading, if available. int getBytesAvailable() //Write data to stream int write(string data) //Write data to stream, only write len bytes int write(string data, int len) //Determine if the stream is open bool isOpen() //Determine if we are at the end of the stream bool isEnd() //Get the error code from the last operation. int getLastError() } */ JSBool register_class_Stream(JSContext *cx); JSObject *Stream_getPrototypeObject(); struct _StreamInformation { int handle; char *buffer; int bufferLength; JSBool eofFlag; }; typedef struct _StreamInformation StreamInformation; #endif