Thrown when a serious I/O error has occurred
Issue: I wanted to upload my ascii input file mentioned below, but this web app prohibits it
Question: can someone let me know how to do it (if it's possible)?
1Z0-803 OCA Java SE 7 Study Guide
Ch. 9, p. 364a, Exercise 9-5
Section 8, Item 5
Recognize common exception classes and categories
Illustrates: [difficulty in] creating an error condition
This class (Exercise9_5) tries to force an IOError through the following steps.
It opens a connection to the input file stored on a thumb drive.It enters a slow loop to read a character at a time from the file.During the slow loop, I pull the thumb drive on which the input file resides.I expect the sudden abscence of the thumb drive to produce an IOError.
Result: I could not force an IOError. However, I did empirically verify the default buffer size.
Use this directory structure to build with the command lines I supply below.
(Dir structure from DOS command "tree /a ." - I had to substitute dots for spaces to get the proper alignment)
Put the source in Q:\src\main\java\Exercise9_5.javaPut the input file on a thumb drive in something like F:\Exercise9_5.txt
To compile this source file ...
Q:\src\main\java>javac -d ..\..\..\target\classes Exercise9_5.java
To run the compiled byte code ...
Q:\src\main\java>java -cp ..\..\..\target\classes Exercise9_5
To create the javadocs for this class ...
Q:\src\main\java>javadoc -d ..\..\..\target\generated-docs -private Exercise9_5.java
Sorry I couldn't actually produce the IOError. I'm still trying different ways to force one ... will post it when I find it.I thought others might benefit from seeing my employment of the book's lessons in my code.I spent a lot of time figuring out how to "javadoc" my code. Others might benefit from what I learned by looking at the example docs in my code.
1Z0-803 preparation summary
I began the book 13 Feb 2013 ... reached this example 26 Apr 2013Spent 1 hour studying in the morning on average 4 days a week.2 to 3 hours studying in the evening on average 2 nights a week.Spent 6 to 8 hours studying on weekends on averageMy goal was to practice coding as much as possible, to the point where I can compile in my head.Toward my goal, I typed in, compiled, corrected (when necessary), and ran every example in the book.
I feel confident about taking the test
Will practice with Enthuware starting in a day or 2.
This book is a valuable learning tool.
Finally, here's my code