| Fast Input/Output in Java 
 
	 
	
		| Author | Message |   
		| Helldemon80 
 
 
 
 
 | 
			
				|  Posted: Tue Jun 22, 2010 9:44 pm    Post subject: Fast Input/Output in Java |  |   
				| 
 |  
				| Hello, 
 Currently i am using the Java 5.0 and I am using the Scanner Class for input. I was just wondering if there is a faster input and also output that will speed up compiling times and if,
 can you show or provide a tutorial for it.
 
 
 Thanks
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| chrisbrown 
 
  
 
 
 | 
			
				|  Posted: Wed Jun 23, 2010 8:48 am    Post subject: RE:Fast Input/Output in Java |  |   
				| 
 |  
				| Most Java libraries are fairly optimized. If the Scanner suits your needs, stick with it, because it does a lot of work for you. 
 If you are reading/writing from a file, a BufferedReader/BufferedWriter may be what you're looking for. There are plenty of tutorials available.
 
 To improve compile times, avoid including entire packages, e.g. import javax.swing.JFrame; rather than import javax.swing.*;
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| DemonWasp 
 
 
 
 
 | 
			
				|  Posted: Wed Jun 23, 2010 12:57 pm    Post subject: RE:Fast Input/Output in Java |  |   
				| 
 |  
				| To speed up compile times, limit your imports as chrisbrown suggests. 
 To speed up your use of Scanner (assuming you're reading from a file), use a BufferedReader. Example:
 
 	  | Java: |  	  | 
Scanner in = new Scanner ( new BufferedReader ( new FileReader ( "myfile.txt" ) ) );
 
 | 
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		|  |  
 |