📄 sipurilist.java
字号:
/* * This file was derived from libdissipate, an open source SIP library. The original file * was modified on 1/23/2001. Please see * http://www.div8.net/dissipate for more information. * * Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> * * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public * License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * *//** * class SipUriList * * This code has been generated using C2J++ * C2J++ is based on Chris Laffra's C2J (laffra@watson.ibm.com) * Read general disclaimer distributed with C2J++ before using this code * For information about C2J++, send mail to Ilya_Tilevich@ibi.com */package org.mitre.jsip;import java.util.*;public class SipUriList extends ArrayList{ /** * SipUriList */ public SipUriList() { } /** * SipUriList * @param parseinput */ public SipUriList(String parseinput) { parseList( parseinput ); } /** * getUriList * @return String */ public String getUriList() { String list = (size() > 0) ? "" : null; boolean first = true; for( ListIterator it = this.listIterator(); it.hasNext(); ) { if( !first ) { list += ", "; } SipUri suri = (SipUri)it.next(); list += suri.nameAddr(); first = false; } return list; } /** * getReverseOrderList * @return String */ public String getReverseOrderList() { Collections.reverse(this); ListIterator it = this.listIterator(); String list = (size() > 0) ? "" : null; boolean first = true; // not sure if this is the way to do this. *** LOOK AT **** //for (; it.hasNext(); it.next()); // we're now at the end. go backwards for( ; it.hasPrevious(); ) { if( !first ) { list += ", "; } SipUri suri = (SipUri)it.previous(); list += suri.nameAddr(); first = false; } return list; } /** * parseList * @param input */ public void parseList(String input) { String inputline; String cururi; int i = 0; inputline = input.trim(); while( i < inputline.length() ) { char c = inputline.charAt(i); if( c == -1 ) { break; } else if( c == ',' ) { cururi = inputline.substring( 0, i - 1 ); this.add( new SipUri( cururi ) ); inputline = inputline.substring( i + 1 ); inputline.trim(); i = 0; } else if( c == '<' ) { while( i < inputline.length() && c != '>' ) i++; } else if( c == '\"' ) { i++; while( i < inputline.length() && c != '\"' ) i++; i++; } else { i++; } } if( i > 0 ) this.add( new SipUri( inputline ) ); } /** * removeHead */ public void removeHead() { this.remove( 0 ); } /** * getHead * @return SipUri */ public SipUri getHead() { return (SipUri)this.get( 0 ); } /** * reverseList * @return SipUriList& */ public SipUriList reverseList() { SipUriList templist = new SipUriList(); for( ListIterator it = this.listIterator(); it.hasNext(); ) { SipUri suri = (SipUri)it.next(); templist.add( 0, suri ); } return templist; } /** * addToHead * @param uri */ public void addToHead(SipUri uri) { this.add( 0, uri ); } /** * addToEnd * @param uri */ public void addToEnd(SipUri uri) { this.add( uri ); } /** * getListLength * @return int */ public int getListLength() { return this.size(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -