"DTD/xhtml1-strict.dtd">
Class RMail::Parser::MultipartReader
In: lib/rmail/parser/multipart.rb
Parent: PushbackReader

A simple interface to facilitate parsing a multipart message.

The typical RubyMail user will have no use for this class. Although it is an example of how to use a PushbackReader, the typical RubyMail user will never use a PushbackReader either. ;-)

Methods
delimiter    epilogue?    new    next_part    preamble?    read_chunk    read_chunk_low   
Public Class methods
new(input, boundary)

Creates a MIME multipart parser.

input is an object supporting a read method that takes one argument, a suggested number of bytes to read, and returns either a string of bytes read or nil if there are no more bytes to read.

boundary is the string boundary that separates the parts, without the "--" prefix.

This class is a suitable input source when parsing recursive multiparts.

Public Instance methods
read_chunk(chunk_size)

Returns the next chunk of data from the input stream as a string. The chunk_size is passed down to the read method of this object's input stream to suggest a size to it, but don't depend on the returned data being of any particular size.

If this method returns nil, you must call next_part to begin reading the next MIME part in the data stream.

read_chunk_low(chunk_size)
next_part()

Start reading the next part. Returns true if there is a next part to read, or false if we have reached the end of the file.

preamble?()

Call this to determine if #read is currently returning strings from the preamble portion of a mime multipart.

epilogue?()

Call this to determine if #read is currently returning strings from the epilogue portion of a mime multipart.

delimiter()

Call this to retrieve the delimiter string that terminated the part just read. This is cleared by #next_part.