home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / in4wjcxu / src / como / io / streamline.java < prev   
Encoding:
Java Source  |  1996-08-14  |  777 b   |  44 lines

  1. /**
  2.  * StreamLine.java  (c) 1996 Jan Kautz & Ulrich Gall
  3.  *
  4.  *
  5.  */
  6.  
  7. package como.io;
  8.  
  9. import como.util.*;
  10. import java.io.*;
  11. import java.util.Vector;
  12.  
  13. /**
  14.  * loads all lines from a DataInputStream.
  15.  */
  16. public class StreamLine {
  17.     public StreamLine() {
  18.     }
  19.  
  20.     /**
  21.      * loads all lines from a DataInputStream
  22.      *
  23.      * @param dis a DataInputStream from where to load
  24.      * @return a Vector with all lines (Strings)
  25.      */
  26.     static public Vector loadLines( DataInputStream dis ) {
  27.         Vector lines = new Vector();
  28.  
  29.         try {
  30.             String l = dis.readLine();
  31.             while ((l != null) && (l.length() > 0)) {
  32.                 lines.addElement( l );
  33.                 l = dis.readLine();
  34.             }
  35.         }
  36.         catch (Exception e) {
  37.             Debug.msg( 30, "Error loading Line from Stream: "+e.toString() ) ;
  38.             return null;
  39.         }
  40.  
  41.         return lines;
  42.     }
  43. }
  44.