Versions Compared

Key

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

...

Code Block
bgColor#ccccff
class SafeBufferedReader extends BufferedReader {
   SafeBufferedReader(Reader in) {
      super(in);
   }

   public int readSafe(char[] cbuf, int off, int len) throws EOFException {
      int read = read(cbuf, off, len);
      if (read == -1) {
         throw new EOFException();
      } else {
         return read;
      }
   }
}

// ...

SafeBufferedReader safeBuffRdr;

try {
   read = safeBuffRdr.readSafe(chBuff, 0, MAX_READ);
   chBuff[read] = TERMINATOR;
} catch (EOFException eof) {
   chBuff[0] = TERMINATOR;
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="667b83bbb21e02ac-446910af-41704548-829c9fac-c2584adf685334a95414a625"><ac:plain-text-body><![CDATA[

[[API 2006

AA. References#API 06]]

[Class Reader

http://download.oracle.com/javase/6/docs/api/java/io/Reader.html]

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