Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Mike Rocha

+ Follow
since Apr 26, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Rocha

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\
  • Put 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
    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

    Some comments:
  • 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 2013
  • Spent 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 average
  • My 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.

  • Result
    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