Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
FileInputStream in;
// initialize stream 
byte data;
while ((data = (byte) in.read()) != -1) { 
  // ... 
}

When the return value of read() method in this noncompliant code example returns is cast to the byte value 0xFF, it will be indistinguishable from the -1 value used to indicate the end of stream, because the byte value is promoted and sign extended to an int before being compared with -1.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="74fa90351a6947fe-59a292e0-410b4751-83d79a54-64e0c892c8d88207e9bc7e83"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

Class InputStream

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="000c31f38ee0c44d-cdb3f69f-4f4944ae-bce89b41-01b2ab833aae6ac19962ce33"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§4.2

http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2] "Primitive Types and Values"

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="003cd486f84fa936-61e30224-4fd84fa6-9eda8c7c-4c1cc5e02116c2d022cd5331"><ac:plain-text-body><![CDATA[

[[Pugh 2008

AA. Bibliography#Pugh 08]]

"Waiting for the end"

]]></ac:plain-text-body></ac:structured-macro>

...