I don't find it helpful. Each time I come back reading the codes, I think I understand it a little more. So maybe I can finally assert the correctness now. But I still think the code is not easily readable. It will be nice if you reorganize the lines.
--Max On Aug 20, 2014, at 10:35, zaiyao liu <zaiyao....@oracle.com> wrote: > Hi Max, > > Sorry for the confuse, how about following chang? > > 136 boolean enDigest = false; > 139 while ((k = dis.read()) != -1) { > 144 dos.write(k); > 145 if (enDigest == false) { // write data into baOut > when dos and dis digest function on > 146 baOut.write(k); > 147 } > 143 dis.on(enDigest); > 148 dos.on(enDigest); > 149 enDigest = !enDigest; > 152 } > > Thanks > > Kevin > δΊ 2014/8/19 22:42, Weijun Wang ει: >> I am understanding the models now, but still don't grasp the read/write >> codes very well. Take the READ example: >> >> 136 boolean enDigest = false; >> 139 while ((k = dis.read()) != -1) { >> 143 dis.on(enDigest); >> 144 dos.write(k); >> 145 if (enDigest == false) { >> 146 baOut.write(k); >> 147 } >> 148 dos.on(enDigest); >> 149 enDigest = !enDigest; >> 152 } >> >> dis.on() is called *after* dis.read() and dos.on() *after* dos.write(). Is >> it possible to change the order so that I can easily see if the read/write >> has any effect on the digest? >> >> Thanks >> Max >> >> On 08/19/2014 10:29 PM, Weijun Wang wrote: >>> I actually don't understand the details in the program. For example, >>> what does the different ReadModels mean? In each case, what bytes are >>> actually write into the streams? There are too many on and off and I >>> don't know what the program is doing. >>> >>> Thanks >>> Max >