01: /*
02: *
03: * Copyright (c) 2004 SourceTap - www.sourcetap.com
04: *
05: * The contents of this file are subject to the SourceTap Public License
06: * ("License"); You may not use this file except in compliance with the
07: * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
08: * Software distributed under the License is distributed on an "AS IS" basis,
09: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
10: * the specific language governing rights and limitations under the License.
11: *
12: * The above copyright notice and this permission notice shall be included
13: * in all copies or substantial portions of the Software.
14: *
15: */
16:
17: package com.sourcetap.sfa.util;
18:
19: import java.util.ArrayList;
20: import java.util.StringTokenizer;
21:
22: /**
23: * DOCUMENT ME!
24: *
25: */
26: public class DelimitedValueDecoder {
27: protected String stringToDecode = "";
28:
29: public DelimitedValueDecoder(String inputString) {
30: stringToDecode = inputString;
31: }
32:
33: /**
34: * DOCUMENT ME!
35: *
36: * @return
37: */
38: public ArrayList decode() {
39: // Split the string into pieces. Example:
40: // * string to decode:
41: // * sectionId;partyId
42: // * Resulting list:
43: // * sectionId
44: // * partyId
45: ArrayList resultList = new ArrayList();
46: StringTokenizer tokSemicolon = new StringTokenizer(
47: stringToDecode, ";");
48:
49: while (tokSemicolon.hasMoreTokens()) {
50: String value = tokSemicolon.nextToken();
51: resultList.add(value);
52: }
53:
54: tokSemicolon = null;
55:
56: return resultList;
57: }
58: }
|