1 % -----------------------------------------------------------------------------
3 % -----------------------------------------------------------------------------
4 \section{\class{wxInputStream
}}\label{wxinputstream
}
6 wxInputStream is an abstract base class which may not be used directly.
8 \wxheading{Derived from
}
10 \helpref{wxStreamBase
}{wxstreambase
}
12 \wxheading{Include files
}
18 \helpref{wxBase
}{librarieslist
}
20 \latexignore{\rtfignore{\wxheading{Members
}}}
25 \membersection{wxInputStream::wxInputStream
}\label{wxinputstreamctor
}
27 \func{}{wxInputStream
}{\void}
29 Creates a dummy input stream.
31 \membersection{wxInputStream::
\destruct{wxInputStream
}}\label{wxinputstreamdtor
}
33 \func{}{\destruct{wxInputStream
}}{\void}
37 \membersection{wxInputStream::CanRead
}\label{wxinputstreamcanread
}
39 \constfunc{bool
}{CanRead
}{\void}
41 Returns true if some data is available in the stream right now, so that
42 calling
\helpref{Read()
}{wxinputstreamread
} wouldn't block.
44 \membersection{wxInputStream::GetC
}\label{wxinputstreamgetc
}
46 \func{char
}{GetC
}{\void}
48 Returns the first character in the input queue and removes it,
49 blocking until it appears if necessary.
53 If EOF, return value is undefined and LastRead() will return
0 and not
1.
55 \membersection{wxInputStream::Eof
}\label{wxinputstreameof
}
57 \constfunc{bool
}{Eof
}{\void}
59 Returns true after an attempt has been made to read past the end of the
64 In wxWidgets
2.6.x and below some streams returned Eof() when the last
65 byte had been read rather than when an attempt had been made to read
66 past the last byte. If you want to avoid depending on one behaviour or
67 the other then call
\helpref{LastRead()
}{wxinputstreamlastread
} to
68 check the number of bytes actually read.
70 \membersection{wxInputStream::LastRead
}\label{wxinputstreamlastread
}
72 \constfunc{size
\_t}{LastRead
}{\void}
74 Returns the last number of bytes read.
76 \membersection{wxInputStream::Peek
}\label{wxinputstreampeek
}
78 \func{char
}{Peek
}{\void}
80 Returns the first character in the input queue without removing it.
84 Blocks until something appears in the stream if necessary, if nothing
85 ever does (i.e. EOF) LastRead() will return
0 (and the return value is
86 undefined), otherwise LastRead() returns
1.
88 \membersection{wxInputStream::Read
}\label{wxinputstreamread
}
90 \func{wxInputStream\&
}{Read
}{\param{void *
}{buffer
},
\param{size
\_t}{ size
}}
92 Reads the specified amount of bytes and stores the data in
{\it buffer
}.
96 The buffer absolutely needs to have at least the specified size.
98 \wxheading{Return value
}
100 This function returns a reference on the current object, so the user can test
101 any states of the stream right away.
103 \func{wxInputStream\&
}{Read
}{\param{wxOutputStream\&
}{ stream
\_out}}
105 Reads data from the input queue and stores it in the specified output stream.
106 The data is read until an error is raised by one of the two streams.
108 \wxheading{Return value
}
110 This function returns a reference on the current object, so the user can test
111 any states of the stream right away.
113 \membersection{wxInputStream::SeekI
}\label{wxinputstreamseeki
}
115 \func{off
\_t}{SeekI
}{\param{off
\_t}{ pos
},
\param{wxSeekMode
}{ mode = wxFromStart
}}
117 Changes the stream current position.
119 \wxheading{Parameters
}
121 \docparam{pos
}{Offset to seek to.
}
123 \docparam{mode
}{One of
{\bf wxFromStart
},
{\bf wxFromEnd
},
{\bf wxFromCurrent
}.
}
125 \wxheading{Return value
}
127 The new stream position or wxInvalidOffset on error.
129 \membersection{wxInputStream::TellI
}\label{wxinputstreamtelli
}
131 \constfunc{off
\_t}{TellI
}{\void}
133 Returns the current stream position.
135 \membersection{wxInputStream::Ungetch
}\label{wxinputstreamungetch
}
137 \func{size
\_t}{Ungetch
}{\param{const char*
}{ buffer
},
\param{size
\_t}{ size
}}
139 This function is only useful in
{\it read
} mode. It is the manager of the "Write-Back"
140 buffer. This buffer acts like a temporary buffer where data which has to be
141 read during the next read IO call are put. This is useful when you get a big
142 block of data which you didn't want to read: you can replace them at the top
143 of the input queue by this way.
145 Be very careful about this call in connection with calling SeekI() on the same
146 stream. Any call to SeekI() will invalidate any previous call to this method
147 (otherwise you could SeekI() to one position, "unread" a few bytes there, SeekI()
148 to another position and data would be either lost or corrupted).
150 \wxheading{Return value
}
152 Returns the amount of bytes saved in the Write-Back buffer.
154 \func{bool
}{Ungetch
}{\param{char
}{c
}}
156 This function acts like the previous one except that it takes only one
157 character: it is sometimes shorter to use than the generic function.