Useful utility applications

1 2 Page 2
Page 2 of 2

The read() method reads the file and transforms its contents into a hexadecimal listing. I use a java.util.Formatter instance to store the entire listing. I use a StringBuffer instance to temporarily store a line's literal characters (or periods).

Compile Listing 2 (javac HexDump.java) and run this application on the resulting classfile (java HexDump HexDump.class). You can also open this file via the menu. Figure 1 shows the result.

Figure 1. Revealing a file's contents via a scrollable text area

Revealing a file's contents via a scrollable text area.

What's next?

Next time, I focus on reading and writing Excel spreadsheets. After revealing a Java spreadsheet library, I show how to download this library and provide a demonstration. Lastly, I show how to create Java applications that leverage this library.

download
Get the source code for this post's applications. Created by Jeff Friesen for JavaWorld

The following software was used to develop the post's code:

  • 64-bit JDK 7u6

The post's code was tested on the following platform(s):

  • JVM on 64-bit Windows 7 SP1
Related:
1 2 Page 2
Page 2 of 2