Java Reference
In-Depth Information
SimpleDateFormat("yyyy-MM-dd HH:mm:ss
z").parse(args[1]);
and
System.err.println("invalid
option: " + args[0]);
tobehelpful.(Wikipedia's“touch(Unix)”
ducesyoutoastandardUnixprogramnamed
touch
.Inadditiontochan-
gingafile'saccessandmodificationtimestamps,
touch
isusedtocreatea
new empty file.)
2. Createanapplicationnamed
Split
forsplittingalargefileintoanumber
of smaller
part
x
files (where
x
starts at 0 and increments; for example,
part0
,
part1
,
part2
,andsoon).Each
part
x
file(exceptpossiblythe
last
part
x
file,whichholdstheremainingbytes)willhavethesamesize.
This application has the following usage syntax:
java Split
path-
name
. Furthermore, your implementation must use the
BufferedIn-
putStream
,
BufferedOutputStream
,
File
,
FileIn-
putStream
, and
FileOutputStream
classes. (I find
Split
helpful
for storing huge files that don't fit onto a single CD/DVD across multiple
CDs/DVDs, and also for emailing huge files to friends. To recombine the
part files on a Windows platform, I use the
copy
command and its
/B
binary option. When recombining the part files, recombine them in order:
part0
,
part1
…
part9
,
part10
, and so on.)
3. It'softenconvenienttoreadlinesoftextfromstandardinput,andthe
In-
putStreamReader
and
BufferedReader
classesmakethistaskpos-
sible. Create an application named
CircleInfo
that, after obtaining a
BufferedReader
instancethat'schainedtostandardinput,entersaloop
that prompts the user to enter a radius, parses the entered radius into a
double
value, and outputs a pair of messages that report the circle's cir-
cumference and area based on this radius.
4.
FindAll
isproblematicinthatyoucanstartanewsearchoperationwhile
an ongoing search is in progress. Also, there's no way to stop an ongo-
ing search except by starting a new search or closing the window. Modify
FindAll
bydisablingitsSearchbuttonwhenasearchisinprogress.Also,
addaStopbuttonthat'sinitiallydisabled,andthatletsyoustopanexisting
search (and also reenables Search).