Java Reference
In-Depth Information
Viewing the Contents of a Data File
To view the contents of the payment data file, programmers construct
a program that creates an instance of the DataInputStream and then uses the
readUTF() methods, in the same way as the BillPayer program used the
DataOutputStream() and writeUTF() methods. For example, to create a program
to read the payment data, declare a variable with the data type DataInputStream.
DataInputStream input;
Then, wrap it in the FileInputStream buffer.
input = new DataInputStream(new
FileInputStream(“payment11192007”));
Finally, code a readUTF() method for each field to read the data from the file.
name.setText(readUTF());
It also is possible to view the contents by opening the file in a text editor,
such as TextPad or Notepad. Be careful not to use a text editor to resave a data
file created in Java because text editors will corrupt the binary nature of the file.
For example, a text editor might display commas or special characters in place of
field separators in a text editor window. If the data file is saved back to disk, the
text editor will save the contents of the data file incorrectly.
Moving to the Web
Many companies are moving their payment services to the Web. As individuals
and companies continue to expand their e-commerce, utility companies, as well
as government agencies, are eager to jump on the Web bandwagon. Most
financial-based institutions such as banks, credit card companies, and stock bro-
kerage firms offer services 24 hours a day over the Web. The anytime, anywhere
capability of the Internet allows information and services to be more available to
more people, with greater convenience and lower cost to customers. Not only do
businesses see the Web as a way to save time and money while serving customers
around the clock, but the Web also prevents them from becoming outdated or
left behind. Analysts predict that by the year 2007, the number of U.S. house-
holds with Internet access will rise to 180 million, doubling from the year 2004.
It is easy to think of the Web exclusively as new technology; it is far more
useful to think of it as a new way to deliver services. Web services combine
traditional functions — such as publishing, business transactions, information
gathering, and data search and retrieval — into a single form of presentation.
Web services also have unique characteristics that require special policy, manage-
ment, and technical attention. The most obvious of these is the speed of techno-
logical change and the rapidly expanding variety of tools and technologies. A less
obvious but perhaps more important characteristic is the completely public
nature of the interaction between an agency and a Web user. In theory, anyone,
anywhere, at any time can have access to an agency on the Web. Customer serv-
ice on a Web site can be linked to other sites without the user's permission or
knowledge. Material can be copied, distributed, and used in ways neither
planned for nor expected. This characteristic gives the Web its excitement and
vitality, but it means a new way of thinking for most government organizations.
Search WWH ::




Custom Search