Corrections to Chapter 12 of Java Secrets, Encoding Data with sun.misc

p. 457: I misinterpreted the M and the G at the beginning of the lines of UUEncoded data. The last paragraph on the page should be replaced with the following:

Also notice the M at the beginning of the first nine lines in the encoded data. The ASCII character M has the value 77. Subtracting the value of the space character, 32, this gives the code value 45. This means that 45 bytes are encoded in each of those lines. This is 360 bits of data. UUencoding 360 bits in 6 bits per byte requires 360 bits / 6 bits/byte = 60 bytes.

If you count the characters in those lines (including spaces but not including line breaks), you'll see that there are 61 characters in each of those lines. The first is the length byte, M. The other 60 characters encode the actual 360 bits of data.

There's nothing magical about M. The tenth line of data begins with a G character, indicating that this line contains 39 bytes of actual data. This is 312 bits of data. UUencoding 312 bits in 6 bits per byte requires 312 bits / 6 bits/encoded byte = 52 encoded bytes. Therefore, the decoder can expect to read 52 bytes before the end of the line. Any extra bytes read are simply padding.

Listing 12-4: The HelloWorld.class file uuencoded

This file is the Java .class file for the HelloWorld program.
You can decode it with uuencode or any compatible decoder.
----------------------cut here------------------------
begin 644 HelloWorld.class
MROZZO@ # "T 'P@ $@< $P< &0< &@< &PH !  )"0 %  H*  , "PP #@ ,
M#  = !8, !X #0$  R@I5@$ %2A,:F%V82]L86YG+U-T<FEN9SLI5@$ !CQI
M;FET/@$ !$-O9&4!  U#;VYS=&%N=%9A;'5E 0 *17AC97!T:6]N<P$ "TAE
M;&QO(%=O<FQD 0 *2&5L;&]7;W)L9 $ #TAE;&QO5V]R;&0N:F%V80$ #TQI
M;F5.=6UB97)486)L90$ %4QJ879A+VEO+U!R:6YT4W1R96%M.P$ #DQO8V%L
M5F%R:6%B;&5S 0 *4V]U<F-E1FEL90$ $VIA=F$O:6\O4')I;G13=')E86T!
M !!J879A+VQA;F<O3V)J96-T 0 0:F%V82]L86YG+U-Y<W1E;0$ !&UA:6X!
M  -O=70!  5P<FEN=  @  ( !        @ ) !P #  !  \    E  (     
M  FR  <2 ;8 "+$    ! !4    *  (    '  @ !     X #  !  \    =
G  $  0    4JMP &L0    $ %0    8  0    (  0 8     @ 4
 
end

Thanks go to Tom Cargill for catching this mistake.


[ Java Secrets Corrections | Java Secrets Home Page | Table of Contents | Examples | About the CD | Order ]

Copyright 1997, 1998 Elliotte Rusty Harold
elharo@sunsite.unc.edu
Last Modified September 17, 1998