?? htiostream.h
字號:
/* W3C Sample Code Library libwww I/O Stream Classes! I/O Stream Classes!*//*** (c) COPYRIGHT MIT 1995.** Please first read the full copyright statement in the file COPYRIGH.*//*The I/O Stream class defines objects which accepts a sequence of charactersto and from a transport The input and outputstream are mainly derived from the generic streamclass and contains much of the same functionality. The main differenceis that the I/O streams also contains methods for reading and writing toa transport.This module is a part of the W3CSample Code Library.*/#ifndef HTIOSTREAM_H#define HTIOSTREAM_Htypedef struct _HTInputStream HTInputStream;typedef struct _HTOutputStream HTOutputStream;#include "HTList.h"#include "HTStream.h"#include "HTChannl.h"/*. Input Stream.An input stream is a stream that can read data from a transport and via achannel putting the data down to the application.*/typedef struct _HTInputStreamClass { char * name;/*This field is for diagnostics only*/ int (*flush) (HTInputStream * me);/*The flush method is introduced in order to allow the stream to putany buffered data down the stream pipe but without taking the stream pipedown. It is for the stream to decide whether it has buffered data or not.In some situations, the stream might not want to send buffered data downthe target as the date might be relevant for this stream only.*/ int (*_free) (HTInputStream * me);/*The free method is like the flush methodbut it also frees the current stream object and all stream objects down stream.When the free method has been called, the whole streampipe (not only this object) should not accept any more data. See also theclose method below*/ int (*abort) (HTInputStream * me, HTList * errorlist);/*The abort method should only be used if a stream is interrupted, forexample by the user, or an error occurs.*/ int (*read) (HTInputStream * me);/*The read method is the method by which we can read data from thetransport layer.*/ int (*close) (HTInputStream * me);/*Pipelined transports need to know how many bytes were consumed by the net object.*/ int (*consumed) (HTInputStream * me, size_t bytes);/*The close method closes the transport and deletes the inputstream object. Note that this is different than the free method which doesn'thave to delete the input stream object itself.*/} HTInputStreamClass;/*. Output Stream.The output stream is similar to the generic streamdefinition in that it has a superset of methods. The paramparameter and the mode parameter can be used for whatever purposesuited.*/typedef struct _HTOutputStreamClass { char * name; int (*flush) (HTOutputStream * me); int (*_free) (HTOutputStream * me); int (*abort) (HTOutputStream * me, HTList * errorlist); int (*put_character)(HTOutputStream * me, char ch); int (*put_string) (HTOutputStream * me, const char * str); int (*put_block) (HTOutputStream * me, const char * str, int len);/*See the generic Stream Definition for an explanationof these methods. Note that they all have a HTOutputStream objecta the parameter, not a generic stream. This is to avoid incompatiblepointer warnings*/ int (*close) (HTOutputStream * me);/*The close method closes the transport and deletes the inputstream object. Note that this is different than the free method which doesn'thave to delete the input stream object itself.*/} HTOutputStreamClass;/*. Transport Streams.Transport streams are special streams with creation methods like definedbelow. Transport streams can be registered in atransport object as ways of communicating withthe a transport.( Transport Input Stream)We have two modes of the input stream depending on model used for data readingis PUSH or PULL. The PUSH model is suitable if we are usingpseudo threads based on a select() call or equivalent and thePULL is suitable in a real thread environment. In the latter caseit doesn't matter if a read procedure blocks as this only concerns a singlethread.*/typedef HTInputStream * HTInput_new (HTHost * host, HTChannel * ch, void * param, int mode);/*( Transport Output Stream)*/typedef HTOutputStream * HTOutput_new (HTHost * host, HTChannel * ch, void * param, int mode);/*( Transport Output Stream Converter)*/typedef HTOutputStream * HTOutputConverter_new( HTHost * host, HTChannel * ch, void * param, int mode, HTOutputStream * target);/**/#endif /* HTIOSTREAM_H *//* @(#) $Id: HTIOStream.html,v 2.6 1999/04/04 00:12:00 frystyk Exp $*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -