


















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of java input/output (i/o) techniques, focusing on file writing using printwriter and object streams, as well as tokenizing strings. Topics include printwriter methods, binary file encryption, object streams, and serialization. The document also covers the use of stringtokenizer for tokenizing strings and reading data from a file.
Typology: Slides
1 / 26
This page cannot be seen from the preview
Don't miss anything!
PrintWriter out = new PrintWriter( new FileWriter( dstFileName, false ), true );
// With append to an existing file PrintWriter outFile1 = new PrintWriter( new FileWriter(dstFileName,true),false);
// With autoflush on println PrintWriter outFile2 = new PrintWriter( new FileWriter(dstFileName,false),true);
outFile1.println( “appended w/out flush” ); outFile2.println( “overwrite with flush” );
BankAccount b =.. .;
ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream("bank.dat"));
out.writeObject(b);
ClassNotFoundException
BankAccount[] arr = new BankAccount[size];
// Now add size BankAccount objects into arr
out.writeObject(arr);
class BankAccount implements Serializable
{
...
}
“25” can be turned into the integer 25