home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-05-08 | 2.5 KB | 64 lines |
- /*
- * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
- *
- * This SOURCE CODE FILE, which has been provided by Borland as part
- * of a Borland product for use ONLY by licensed users of the product,
- * includes CONFIDENTIAL and PROPRIETARY information of Borland.
- *
- * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
- * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
- * THE PRODUCT.
- *
- * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
- * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
- * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
- * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
- * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
- * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
- * CODE FILE.
- */
- package visibroker.samples.pass_by_value.list;
-
- import java.io.*;
- import java.util.*;
-
- public class ListClient {
-
- public static void main(String[] args) throws Exception {
- org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);
- ListUtility lu = ListUtilityHelper.bind(orb);
- {
- List list = new List("Hello", new List("World", null));
- System.out.println("list: " + list);
- System.out.println("length: " + lu.length(list));
- System.out.println("reverse: " + lu.reverse(list));
- System.out.println("sort: " + lu.sort(list));
- }
- {
- List list = new List("this", new List("is", new List("a", new List("test", null))));
- System.out.println("list: " + list);
- System.out.println("length: " + lu.length(list));
- System.out.println("reverse: " + lu.reverse(list));
- System.out.println("sort: " + lu.sort(list));
- }
- {
- // read in the contents of a file
- InputStream input = new FileInputStream("ListUtility.java");
- byte[] bytes = new byte[input.available()];
- input.read(bytes);
- String text = new String(bytes);
- List list = null;
- // break the input into tokens (ignoring white space and puctuation)
- StringTokenizer tokenizer = new StringTokenizer(text, " \n.;,/{}()");
- while(tokenizer.hasMoreTokens()) {
- list = new List(tokenizer.nextToken(), list);
- }
- System.out.println("list: " + list);
- System.out.println("length: " + lu.length(list));
- System.out.println("reverse: " + lu.reverse(list));
- System.out.println("sort: " + lu.sort(list));
- }
- }
-
- }
-