Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Fast Input/Output in Java
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Helldemon80




PostPosted: 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
Sponsor
sponsor
chrisbrown




PostPosted: 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




PostPosted: 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" ) ) );
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: