istream.h revision 0c1835a90dd1dcedaeaedd1cd91672299cbeb5be
1968N/A/* Note that some systems (Solaris) may use a macro to redefine struct stat */ 1968N/A unsigned int mmaped:
1;
/* be careful when copying data */ 1968N/A unsigned int eof:
1;
/* read() has reached to end of file 1968N/A (but may still be data available in buffer) */ 1968N/A/* Open the given path only when something is actually tried to be read from 2028N/A/* Set name (e.g. path) for input stream. */ 2028N/A/* Get input stream's name. If stream itself doesn't have a name, 2301N/A it looks up further into stream's parents until one of them has a name. 2028N/A Returns "" if stream has no name. */ 1968N/A/* i_stream_close() + i_stream_unref() */ 2028N/A/* Reference counting. References start from 1, so calling i_stream_unref() 2028N/A destroys the stream if i_stream_ref() is never used. */ 2028N/A/* Unreferences the stream and sets stream pointer to NULL. */ 2028N/A/* Call the given callback function when stream is destroyed. */ 2616N/A/* Remove the destroy callback. */ 2028N/A/* Return file descriptor for stream, or -1 if none is available. */ 1968N/A/* Mark the stream closed. Any reads after this will return -1. The data 1968N/A already read can still be used. */ 2028N/A/* Sync the stream with the underlying backend, ie. if a file has been 2028N/A modified, flush any cached data. */ 2028N/A/* Change the initial size for stream's input buffer. This basically just 1968N/A grows the read buffer size from the default. This function has no effect 2301N/A unless it's called before reading anything. */ 1968N/A/* Change the maximum size for stream's input buffer to grow. Useful only 1968N/A for buffered streams (currently only file). */ 1968N/A/* Returns the current max. buffer size. */ 1968N/A/* Returns number of bytes read if read was ok, -1 if EOF or error, -2 if the 1968N/A/* Skip forward a number of bytes. Never fails, the next read tells if it 1968N/A/* Seek to specified position from beginning of file. Never fails, the next 1968N/A read tells if it was successful. This works only for files. */ 1968N/A/* Like i_stream_seek(), but also giving a hint that after reading some data 1968N/A we could be seeking back to this mark or somewhere after it. If input 1968N/A stream's implementation is slow in seeking backwards, it can use this hint 1968N/A to cache some of the data in memory. */ 2301N/A/* Returns 0 if ok, -1 if error. As the underlying stream may not be 2301N/A a file, only some of the fields might be set, others would be zero. 2301N/A st_size is always set, and if it's not known, it's -1. 2301N/A If exact=FALSE, the stream may not return exactly correct values, but the 2301N/A returned values can be compared to see if anything had changed (eg. in 2301N/A compressed stream st_size could be compressed size) */ 2301N/A/* Similar to i_stream_stat() call. Returns 1 if size was successfully 2301N/A set, 0 if size is unknown, -1 if error. */ 2301N/A/* Returns TRUE if there are any bytes left to be read or in buffer. */ 1968N/A/* Returns TRUE if there are no bytes buffered and read() returns EOF. */ 1968N/A/* Returns the absolute offset of the stream. This is the stream's current 1968N/A v_offset + the parent's absolute offset when the stream was created. */ 1968N/A/* Gets the next line from stream and returns it, or NULL if more data is 1968N/A needed to make a full line. i_stream_set_return_partial_line() specifies 1968N/A if the last line should be returned if it doesn't end with LF. */ 1968N/A/* Like i_stream_next_line(), but reads for more data if needed. Returns NULL 1968N/A if more data is needed or error occurred. */ 1968N/A/* Returns TRUE if the last line read with i_stream_next_line() ended with 1968N/A/* Returns pointer to beginning of read data, or NULL if there's no data 2301N/A/* Like i_stream_get_data(), but returns non-const data. This only works with 2028N/A buffered streams (currently only file), others return NULL. */ 2301N/A/* Like i_stream_get_data(), but read more when needed. Returns 1 if more 1978N/A than threshold bytes are available, 0 if as much or less, -1 if error or 2510N/A EOF with no bytes read that weren't already in buffer, or -2 if stream's 2028N/A/* Append external data to input stream. Returns TRUE if successful, FALSE if 2301N/A there is not enough space in the stream. */