Method definition of the category class:
· Constructor: Public writable (inputstream source );
· Set the read delimiter: Public incluusedelimiter (string pattern );
· Determine whether data exists: Public Boolean hasnextxxx ();
· Data Retrieval: Public Data Type nextxxx ();
1 package CN. demo; 2 3 Import Java. io. file; 4 Import Java. io. fileinputstream; 5 import Java. util. optional; 6 7 public class test {8 public static void main (string [] ARGs) throws exception {9 writable scan = new writable (New fileinputstream (new file ("E: "+ file. separator + "ly" + file. separator + "testone. java "); 10 scan. usedelimiter ("\ n"); 11 while (scan. hasnext () {12 system. out. println (scan. next (); 13} 14 scan. close (); 15} 16}
Summary: The program uses the delimiter for input data (if the Delimiter is not good, bufferedreader is used ).
Use iterator to input data-read text data