This class provides support for parsing MIME messages into GSMimeDocument objects. Each parser object maintains an associated document into which data is stored.
You supply the document to be parsed as one or more data
items passed to the Parse:
method, and (if
the method always returns YES
, you give it
a final nil
argument to mark the end of the
document.
On completion of parsing a valid document, the
document
method returns the resulting parsed document.
The default implementation supports the following transfer
encodings specified in either a transfer-encoding
of content-transfer-encoding
header -
Decodes the raw data from the specified range in the source data object and appends it to the destination data object. The context object provides information about the content encoding type in use, and the state of the decoding operation.
This method may be called repeatedly to incrementally decode information as it arrives on some communications channel. It should be called with a nil source data item (or with the atEnd flag of the context set to YES) in order to flush any information held in the context to the output data object.
You may override this method in order to implement additional coding schemes.
This method is called repeatedly to pass raw mime data into
the parser. It returns YES
as long as it wants
more data to complete parsing of a document, and NO
if parsing is complete, either due to having reached the end of
a document or due to an error.
Since it is not always possible to determine if the end of a MIME document has been reached from its content, the method may need to be called with a nil argument after you have passed all the data to it ... this tells it that the data is complete.
This method is called to parse a header line for the current document, split its contents into an info dictionary, and add that information to the document.
The standard implementation of this method scans basic
information and then calls scanHeaders:named:into:
to complete the parsing of the header.
This method also performs consistency checks on headers scanned
so it is recommended that it is not overridden, but that
subclasses override scanHeaders:named:into:
to
implement custom scanning.
As a special case, for HTTP support, this method also parses
lines in the format of HTTP responses as if they were headers
named http
. The resulting header info dictionary
contains -
This method is called to parse a header line and split its contents into an info dictionary.
On entry, the dictionary is already partially filled, the name argument is a lowercase representation of the header name, and the scanner is set to a scan location immediately after the colon in the header string.
If the header is parsed successfully, the method should return YES, otherwise NO.
You should not call this method directly yourself, but may override it to support parsing of new headers.
You should be aware of the parsing that the standard implementation performs, and that needs to be done for certain headers in order to permit the parser to work generally -