This chapter does not appear in the book.
Barcodes come in many varieties, roughly divided into linear (1D) and geometric (2D) patterns. A good summary of the main ones, including illustrations, can be found at the Wikipedia page on barcodes.
My interest lies in reading barcode information using a PC’s webcam, which led me to the QR Code barcode, an example of which appears in the picture at the top of this page.
A QR Code can store small amounts of text, typically contact information (vCards), URLs, or e-mail addresses. For example, the barcode in the picture is an encoding of my Home page address, http://fivedots.coe.psu.ac.th/~ad.
QR Codes can encode four different kinds of data: alphanumeric characters, digits, binary, or Kanji. The different types have different upper limits for the amount of information a single QR Code can hold. You can't mix data types within a QR code.
QR Code support is becoming standard in mobile devices, and the aim of this chapter is to duplicate that functionality in Java SE. I want to point my netbook’s camera at a QR Code (as in the picture) and, depending on whether the barcode contains a URL or e-mail address, fire up a browser or e-mail client.
One requirement is not to implement the browser or e-mail client in Java, but instead invoke suitable applications on the device. For this, I’ll use the Java Desktop API, introduced in Java 6.