Versions Compared

Key

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

...

Compliant Solution (Accessible Class Variable)

If a program another class intends to use System.in as well as this the InputLibrary class InputLibrary, the program class must use the same buffered wrapper as does this class rather than which is used by InputLibrary, instead of creating and using its own additional buffered wrapper. Consequently, library InputLibrary must make available a reference to the buffered wrapper to support this functionalityfor such classes.

Code Block
bgColor#ccccff
public final class InputLibrary {
  private static BufferedInputStream in = new BufferedInputStream(System.in);

  static BufferedInputStream getBufferedWrapper() {
    return in;
  }

  // ...other methods
}


// Some code that requires user input from System.in
class AppCode {
  private static BufferedInputStream in;

  AppCode() {
    in = InputLibrary.getBufferedWrapper();
  }

  // ...other methods
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="38f1a18797751112-2cae5427-43a34e14-82d98948-627b5c1d5b2590572cff2c19"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[method read

http://java.sun.com/javase/6/docs/api/java/io/InputStream.html#read()]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1a61026cb036ac11-17d976dc-4add4ecf-a7abb2da-c9e5e646dbde9b25cf489349"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

[class BufferedInputStream

http://java.sun.com/javase/6/docs/api/java/io/BufferedInputStream.html]

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

...