J2EEOnlineJ2EE 





Java Streams   «Prev  Next»
Lesson 4Java Streams Course Project
ObjectiveExamine what the Course Project entails

Java Streams Course Project

In this course you're going to develop a character-mode program called FileDumper that accepts a filename and a command line switch as inputs and dumps the specified file in ASCII, hex, decimal, floating point numbers, double-precision floating point numbers, shorts, ints, or longs.
The value of the command line switch will determine the data format of the dump.
Since this program is going to be developed in several steps, it's important to try to keep your code as general and adaptable as possible.

In order to meet the requirements in a particular module, previously written code may have to be refactored.
You won't start working on the course project until you've gained some preliminary skills. In the first few modules, you'll have a chance to write smaller programs and submit them.
In that course, you'll turn the character-mode program into one with a graphical user interface that lets you open any file and view its contents in a variety of ways.
In the next lesson, we'll explain how the course works and what you need to get started.




Java I/O is Interesting

There are plenty of reasons for Java programmers to find I/O interesting. Java includes a rich set of I/O classes in the core API, mostly in the java.io package. For the most part I/O in Java is divided into two types:
  1. byte- and
  2. number-oriented I/O,
which is handled by streams (input and output) and character and text I/O, which is handled by readers and writers. Both types provide an abstraction for external data sources and targets that allows you to read from and write to them, regardless of the exact type of the source. You use the same methods to read from a file that you do to read from the console or from a network connection.
Once you have defined abstractions that let you read or write without caring where your data is coming from or where it's going to, you are able to do many things. You can define I/O streams that automatically compress, encrypt, and filter from one data format to another. Once you have these tools, programs can send encrypted data or write zip files with almost no knowledge of what they are doing.
Cryptography or compression can be isolated to a few lines of code that say, "Make this an encrypted output stream." This course includes all the different kinds of streams you can use. We are also going to investigate Java's support for Unicode (the standard multilingual character set).
We will look at Java's powerful facilities for formatting I/O, which is not part of the java.io package.
Finally, the Java Communications API (javax.comm) will be examined, which provides the ability to do low-level I/O through a computer's serial and parallel ports[1]. If you do find I/O uninteresting, you probably don't know as much about it as you should. I/O is the means for communication between software and the outside world (including both humans and other machines). Java provides a powerful and flexible set of tools for enabling the communication between humans, machines, and cyborgs..

[1] Difference between a serial port and a parallel port is that a serial port transmits data one bit after another, while a parallel port transmits all 8 bits of a byte in parallel.