return new HeaderParser(line);
/** * Parse the weekday field * @return an integer with the calendar content for wkday. */ protected int wkday() throws ParseException { dbg_enter("wkday"); try { String tok = lexer.ttoken(); String id = tok.toLowerCase(); if (TokenNames.MON.equalsIgnoreCase(id)) return Calendar.MONDAY; else if (TokenNames.TUE.equalsIgnoreCase(id)) return Calendar.TUESDAY; else if (TokenNames.WED.equalsIgnoreCase(id)) return Calendar.WEDNESDAY; else if (TokenNames.THU.equalsIgnoreCase(id)) return Calendar.THURSDAY; else if (TokenNames.FRI.equalsIgnoreCase(id)) return Calendar.FRIDAY; else if (TokenNames.SAT.equalsIgnoreCase(id)) return Calendar.SATURDAY; else if (TokenNames.SUN.equalsIgnoreCase(id)) return Calendar.SUNDAY; else throw createParseException("bad wkday"); } finally { dbg_leave("wkday"); } }
/** * Add a SIP header. * * @param sipHeader -- string version of SIP header to add. */ public void addHeader(String sipHeader) { String hdrString = sipHeader.trim() + "\n"; try { HeaderParser parser = ParserFactory.createParser(sipHeader); SIPHeader sh = parser.parse(); this.attachHeader(sh, false); } catch (ParseException ex) { this.getUnrecognizedHeadersList().add(hdrString); } }
public SIPHeader parse() throws ParseException { if (debug) dbg_enter("AccessNetworkInfoParser.parse"); try { headerName(TokenTypes.P_ACCESS_NETWORK_INFO); PAccessNetworkInfo accessNetworkInfo = new PAccessNetworkInfo(); accessNetworkInfo.setHeaderName(SIPHeaderNamesIms.P_ACCESS_NETWORK_INFO); this.lexer.SPorHT(); lexer.match(TokenTypes.ID); Token token = lexer.getNextToken(); accessNetworkInfo.setAccessType(token.getTokenValue()); this.lexer.SPorHT(); while (lexer.lookAhead(0) == ';') { this.lexer.match(';'); this.lexer.SPorHT(); NameValue nv = super.nameValue('='); accessNetworkInfo.setParameter(nv); this.lexer.SPorHT(); } this.lexer.SPorHT(); this.lexer.match('\n'); return accessNetworkInfo; } finally { if (debug) dbg_leave("AccessNetworkInfoParser.parse"); } }
int day = Integer.parseInt(s1); if (day <= 0 || day > 31) throw createParseException("Bad day "); retval.set(Calendar.DAY_OF_MONTH, day); lexer.match(' '); throw createParseException("bad date field");
public SIPHeader parse() throws ParseException { if (debug) dbg_enter("AccessNetworkInfoParser.parse"); try { headerName(TokenTypes.P_ACCESS_NETWORK_INFO); PAccessNetworkInfo accessNetworkInfo = new PAccessNetworkInfo(); accessNetworkInfo.setHeaderName(SIPHeaderNamesIms.P_ACCESS_NETWORK_INFO); this.lexer.SPorHT(); lexer.match(TokenTypes.ID); Token token = lexer.getNextToken(); accessNetworkInfo.setAccessType(token.getTokenValue()); this.lexer.SPorHT(); while (lexer.lookAhead(0) == ';') { this.lexer.match(';'); this.lexer.SPorHT(); NameValue nv = super.nameValue('='); accessNetworkInfo.setParameter(nv); this.lexer.SPorHT(); } this.lexer.SPorHT(); this.lexer.match('\n'); return accessNetworkInfo; } finally { if (debug) dbg_leave("AccessNetworkInfoParser.parse"); } }
/** * Set the time field. This has the format hour:minute:second */ protected void time(Calendar calendar) throws ParseException { try { String s = lexer.number(); int hour = Integer.parseInt(s); calendar.set(Calendar.HOUR_OF_DAY, hour); lexer.match(':'); s = lexer.number(); int min = Integer.parseInt(s); calendar.set(Calendar.MINUTE, min); lexer.match(':'); s = lexer.number(); int sec = Integer.parseInt(s); calendar.set(Calendar.SECOND, sec); } catch (Exception ex) { throw createParseException("error processing time "); } }
if (hp == null) throw new ParseException("could not create parser", 0); return hp.parse();
SIPHeader sipHeader = headerParser.parse(); message.attachHeader(sipHeader, false); } catch (ParseException ex) {
super.parse(); return pps;
super.parse(); return pps;