Java SE IO

Print the objectives

Take the exam   Take a beta test

This exam is mainly focused on classes of the java.io package.



To pass this exam you will be required to understand:

  • The distinctions between types of File.
  • How to access those files.
  • Reader/Writer and InputStream/OutputStream implementations and their usages.
  • Bridging between Readers, Writers, InputStreams, and OutputStreams.
  • Basic serialization.
  • And finally, using ResourceBundles and Properties

Note: Examinees should be able to process all exceptional conditions thrown during operations in the constructors and methods tested in the following objectives.

This examination does not cover non-blocking IO in the java.nio package and its subpackages.

As per all examinations in this section, questions are sourced from Java 1.4 unless explicitly stated otherwise.

  Released  Beta  Frozen  

ResourceBundle and Properties

Property management
 
 

Properties  1 question

Demonstrate proper usage of the following Properties methods:

  • setProperty(),
  • getProperty(String) & getProperty(String, String)

Write code to correctly serialize/deserialize Properties instances with:

  • store(),
  • load()

Display comprehension of both the format and the character escaping of a serialized Properties instance.

9 23 13

ResourceBundle  2 questions

Demonstrate comprehension of the hierarchical nature of resource bundles.

Write code to get an instance of a resource bundle using the static methods:

  • getBundle(String),
  • getBundle(String, Locale)

Display correct access techniques using:

  • getKeys(),
  • getObject(),
  • getString()

Be able to correctly identify which values will be returned, given a hierarchy and a specific locale, in typical i18n scenarios.

8 1 12

API's

Use of the various types of File, their creation and deletion.

Managing the content of files using the various character and byte stream tools.

 
 

File & RandomAccessFile  2 questions

Display understanding of the File class.

Write code to navigate the file system using:

  • listRoots()
  • listFiles(),
  • listFiles(FileFilter),
  • listFiles(FileNameFilter),
Display familiarity with the two above filters.

Demonstrate the creation of file instances using:

  • File(String),
  • File(String, String),
  • File(File, String), and,
  • createTempFile()

Explain at what point a physical representation of the file is created. Demonstrate the usage of:

  • createNewFile() and
  • createTempFile()

Also explain the differences between the files created using these two methods.

Determine the current state of a File using the following methods:

  • canRead(),
  • canWrite(),
  • isDirectory(),
  • isFile(),
  • exists(),
  • length(), and,
  • lastModified()

Write code to delete files using:

  • delete(),
  • deleteOnExit()
And, explain how these two methods differ.

Write code to create directory structures using:

  • mkdir(), and,
  • mkdirs()
And, explain how these two methods differ.

Display understanding of the RandomAccessFile class.

Write code to construct a RandomAccessFileInstance using:

  • RandomAccessFile(File, String), and,
  • RandomAccessFile(String, String)
Modes in the test are restricted to "r" and "rw" only.

Demonstrate correct usage of:

  • read(),
  • read*() (excluding Unsigned methods),
  • write(),
  • write*(),
  • seek(), and,
  • setLength(),

Use the RandomAccessFile to read and write data in a non-sequential order.

19 154 18

Bridges: InputStreamReader, OutputStreamWriter  2 questions

Demonstrate reading character streams by decoding from a byte stream using InputStreamReader as a decorator of an InputStream. Using:

  • InputStreamReader(InputStream)
  • InputStreamReader(InputStream, String)

Demonstrate encoding to byte streams from a character stream using OutputStreamWriter as a decorator of an Writer. using:

  • OutputStreamWriter(OutputStream)
  • OutputStreamWriter(OutputStream, String)
4 16 19

Readers and Writers  3 questions

Display comprehension of the character based nature of Reader and Writer implementations.

Write code to construct any of the following Reader implementations:

  • FileReader,
  • StringReader,
  • FilterReader,
  • BufferedReader,
  • LineNumberReader,
  • PipedReader and
  • PushbackReader

Be able to write code to:

  • Use BufferedReader as a decorator, and demonstrate understanding of the buffering mechanism's behaviour using the readLine() method,
  • Write code using PipedReader for multi-thread intercommunication, and,
  • Demonstrate use of PushbackReader to unread characters from the stream.

Write code to construct any of the following Writer implementations:

  • FileWriter,
  • StringWriter,
  • PrintWriter,
  • FilterWriter,
  • BufferedWriter and
  • PipedWriter

Be able to write code to:

  • Use BufferedWriter as a decorator, and demonstrate usage of the newLine() method,
  • Use PipedWriter for multi-thread intercommunication, and,
  • Use CharArrayReader and CharArrayWriter to perform in-memory streaming of character data.

Finally, be able to identify which of the above Reader/Writer implementations to use in tightly defined circumstances.

13 92 18

InputStream and OutputStream  2 questions

Display comprehension of the byte based nature of InputStream and OutputStream implementations.

Write code to construct any of the following InputStream implementations:

  • FileInputStream,
  • ObjectInputStream,
  • PipedInputStream,
  • DataInputStream, and,
  • PushbackInputStream

Demonstrate usage of these InputStreams by:

  • Reading content from a file using FileInputStream, and,
  • Deserializing Object instances and primitives from an ObjectInputStream, and,
  • Providing inter-thread communication using PipedInputStream
  • Using a PushbackInputStream to unread bytes from a stream.

Write code to construct any of the following OutputStream implementations:

  • FileOutputStream,
  • ObjectOutputStream,
  • PipedOutputStream, and,
  • DataOutputStream

Demonstrate usage of both OutputStream types by:

  • Writing content to a file using FileOutputStream,
  • Serializing Object instances and primitives to an ObjectOutputStream and,
  • Providing inter-process communication using PipedOutputStream

Write code using ByteArrayInputStream and ByteArrayOutputStream to perform in-memory streaming of byte data.

Be able to identify which of the above InputStream/OutputStream implementations to use in tightly defined circumstances.

12 70 18

Serialization  3 questions

Display understanding of serialization by developing code using both:

  • The java.io.Serializable interface, and,
  • The transient keyword

Indicate understanding of the concept of the Serializable interface being a marker interface, that requires no methods implementations.

Display correct usage of the serialVersionUID member:

  • Explain its usage in versioning of serialized objects,
  • Identify the runtime impacts of definition versus non-definition of this member in a class that implements Serializable,
  • Indicate the outcome of deserializing an Object with a mismatching serialVersionUID.

Demonstrate usage of the readResolve() method to protect singleton integrity.

The following topics are excluded from this category's questions:

  • readObject,
  • writeObject(), and,
  • the Externalizable interface
18 136 28

Exam information

  • 22 minutes
  • 15 questions (701)
  • 80% required
  • +2 √
  • - 8  points
  • 15 day delay
  • status: released

Top contributors