aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes I/O - Sun objective Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "I/O - Sun objective" Watch "I/O - Sun objective" New topic
Author

I/O - Sun objective

Deepa sivasankar
Ranch Hand

Joined: Jul 22, 2003
Posts: 35
I found this in the sun objective. Can someone explain to me ?. I appreciate your help.
"Destinguish between conditions under which platform default encoding conversion should be used and conditions under which a specific conversion should be used. "
Thanks
Deepa
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Deepa,
Readers and Writers accommodate different (Unicode) encoding schemes. Naturally they have constructors which take an encoding scheme as the argument and use it for reading/writing. If no encoding is explicitly specified, the default scheme is used.
For the SCJP, you are required to know, how to make use of such constructors. ie., if an encoding scheme is given to you, how would you construct the reader/writer object. You should also understand what a default scheme means, and how to construct reader/writer objects to make use of default schemes.
IMO, this is one of the easiest SCJP objectives and with little effort you can get the answers right. More about this in Java API Documentation.
Hope this helps,
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Jakob Bosshard
Greenhorn

Joined: May 30, 2000
Posts: 21
Hi Deepa
On top of what Ajith said, I would like to add the following links which explain internationalization. The first link gives a list of all encodings you can use for your I/O. The second is
just the top level link that explains the entire concept.
http://java.sun.com/products/jdk/1.2/docs/guide/internat/encoding.doc.html
http://java.sun.com/products/jdk/1.2/docs/guide/internat/
Good luck
Jakob
Deepa sivasankar
Ranch Hand

Joined: Jul 22, 2003
Posts: 35
Thanks ajith.
i have one more objective .
"Describe the permanent effects on the file system of constructing and using FileInputStream, FileOutputStream, and RandomAccessFile objects"
Can anyone explain or point me to the right place??
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
That's easy.
Permanent effect means some operation that has a durable effect on your local file system, even after the scope of the program. Something like a file being created/renamed/modified/deleted etc.
You will have to know which I/O classes has a permanent effect on the local file system. Creation usually happens when you create an output stream( and RandomAccessFile with a certain mode ), and if the file doesn't exist, then a new file will be created. I am intentionally being as brief as possible so that you can do some investigation yourself
Note that apart from streams, even the File object belongs to this category. Though File object only represents an abstract path, it provides pretty powerful methods to rename, delete the underlying file. You may have to read the question carefully if File is one of the options given to you.
Good luck and hope you will be able to find some more information on Java DOC API.
Ajith
Deepa sivasankar
Ranch Hand

Joined: Jul 22, 2003
Posts: 35
Thanks jakob.
Jakob Bosshard
Greenhorn

Joined: May 30, 2000
Posts: 21
Hi
The fact is that the class file in java.io.File does not have any impact on the underlying file system. It is just a logical concept of a file. But as soon as you start to operate with streams such as FileInputStream or RandomAccessFile you really operate on the physical file. You should be aware that writing can overwrite the entire file etc. Just experiment with the methods of those streams, e.g.:
try {
File file = new File("C:/","NewFile.txt");
FileOutputStream fileOutput = new FileOutputStream(file);
fileOutput.close();
} catch(IOException e) {}
This code will create an empty file.
Have fun
Jakob
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Jakob,
I will take your statement about File a pinch of salt.
You are right, File object will not create a file. However, it does a lot of other things which might leave a permanent effect on the local file system. For example, it can create directories,
it can rename files, it can even delete files. Take a look at these methods delete(),deleteOnExit(),renameTo()
This is one of the reasons why you need to be careful while taking the exam. Read the question twice especially if File is one of the answers given. On the issues mentioned above, it certainly can cause permanent effect on the file system.
Ajith
Eric Barnhill
Rancher

Joined: Feb 25, 2000
Posts: 233

not to mention File.createNewFile() .
Eric B.
Jakob Bosshard
Greenhorn

Joined: May 30, 2000
Posts: 21
Hi Ajith and Eric
Thanks for your reply. I will carefully recheck the java.io.File and write some sample code to illustrate the permanent effects.
Thanks for telling me.
SEEYA
Jakob
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I/O - Sun objective
 
Similar Threads
I/O is killing me !
Encoding objective
io exam objectives
Input/Output for SCJP.
Encoding