FileDocCategorySizeDatePackage
ContentLengthParser.javaAPI DocphoneME MR2 API (J2ME)2668Wed May 02 18:00:42 BST 2007gov.nist.siplite.parser

ContentLengthParser

public class ContentLengthParser extends HeaderParser
Parser for Content-Length Header.
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
Constructors Summary
public ContentLengthParser()
Default constructor.

 
public ContentLengthParser(String contentLength)
Constructor with initial content length header string.

param
contentLength initial content length header field

        super(contentLength);
    
protected ContentLengthParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

        super(lexer);
    
Methods Summary
public Headerparse()
Invokes parser for content length header field.

return
the parsed content length header

        if (debug) dbg_enter("ContentLengthParser.enter");
        try {
            ContentLengthHeader contentLength = new ContentLengthHeader();
            headerName(TokenTypes.CONTENT_LENGTH);
            String number = lexer.number();
            contentLength.setContentLength(Integer.parseInt(number));
            this.lexer.SPorHT();
            this.lexer.match('\n");
            return contentLength;
        } catch (ParseException pe) {
            throw createParseException(pe.getMessage());
        } finally {
            if (debug) dbg_leave("ContentLengthParser.leave");
        }