protected static boolean isUnreserved(char next) { return Lexer.isAlphaDigit(next) || isMark(next); }
/** * Create a new Request Line from a String. * */ public SipRequestLine createRequestLine(String requestLine) throws ParseException { RequestLineParser requestLineParser = new RequestLineParser(requestLine); return (SipRequestLine) requestLineParser.parse(); }
/** * Create a new StatusLine from a String. */ public SipStatusLine createStatusLine(String statusLine) throws ParseException { StatusLineParser statusLineParser = new StatusLineParser(statusLine); return (SipStatusLine) statusLineParser.parse(); }
/** * Creates new HeaderParser * @param String to parse. */ protected HeaderParser(String header) { this.lexer = new Lexer("command_keywordLexer", header); }
@Override public SIPMessage parseSIPMessage(byte[] msgBuffer, boolean readBody, boolean strict, ParseExceptionListener parseExceptionListener) throws ParseException { return super.parseSIPMessage(msgBuffer, readBody, strict, parseExceptionListener); }
/** * Parse a uri from a string and return a URI structure for it. * * @param url * a String containing the URI structure to be parsed. * @return A parsed URI structure * @exception ParseException * if there was an error parsing the message. */ public GenericURI parseUrl(String url) throws ParseException { return new URLParser(url).parse(); }
public MessageParser createMessageParser(SIPTransactionStack stack) { return new StringMsgParser(); }
private void readStream(InputStream inputStream) throws IOException { boolean isPreviousLineCRLF = false; while(true) { // We read continiously from the bytes we receive and only break where there are no more bytes in the inputStream passed to us if(currentStreamEnded) break; // The stream ends when we have read all bytes in the chunk NIO passed to us else { if(readingHeaderLines) {// We are in state to read header lines right now isPreviousLineCRLF = readMessageSipHeaderLines(inputStream, isPreviousLineCRLF); } if(readingMessageBodyContents) { // We've already read the headers an now we are reading the Contents of the SIP message (which doesn't generally have lines) readMessageBody(inputStream); } } } }
/** * parse the String message * @return SIPHeader (ProxyAuthenticate object) * @throws ParseException if the message does not respect the spec. */ public SIPHeader parse() throws ParseException { headerName(TokenTypes.PROXY_AUTHORIZATION); ProxyAuthorization proxyAuth = new ProxyAuthorization(); super.parse(proxyAuth); return proxyAuth; }
/** * parse the String message * @return SIPHeader (ProxyAuthenticate object) * @throws ParseException if the message does not respect the spec. */ public SIPHeader parse() throws ParseException { headerName(TokenTypes.PROXY_AUTHENTICATE); ProxyAuthenticate proxyAuthenticate = new ProxyAuthenticate(); super.parse(proxyAuthenticate); return proxyAuthenticate; }
@Override public void addPlaintextBytes(byte[] bytes) throws Exception { nioParser.addBytes(bytes); }
/** * Default parse method. This method just calls uriReference. */ public GenericURI parse() throws ParseException { return uriReference( true ); }
public Lexer(String lexerName, String buffer) { super(lexerName, buffer); this.selectLexer(lexerName); }
/** * Parse the SIP Request Line * * @param requestLine * a String containing the request line to be parsed. * @return a RequestLine structure that has the parsed RequestLine * @exception ParseException * if there was an error parsing the requestLine. */ public RequestLine parseSIPRequestLine(String requestLine) throws ParseException { requestLine += "\n"; return new RequestLineParser(requestLine).parse(); }
/** * Parse the SIP Response message status line * * @param statusLine * a String containing the Status line to be parsed. * @return StatusLine class corresponding to message * @exception ParseException * if there was an error parsing * @see StatusLine */ public StatusLine parseSIPStatusLine(String statusLine) throws ParseException { statusLine += "\n"; return new StatusLineParser(statusLine).parse(); }
public RequestLineParser(String requestLine) { this.lexer = new Lexer("method_keywordLexer", requestLine); } public RequestLineParser(Lexer lexer) {
protected void addBytes(byte[] bytes) throws Exception { nioParser.addBytes(bytes); }
public URLParser(String url) { this.lexer = new Lexer("sip_urlLexer", url); }
public StatusLineParser(String statusLine) { this.lexer = new Lexer("status_lineLexer", statusLine); }
public AddressParser(String address) { this.lexer = new Lexer("charLexer", address); }