@Override public synchronized int read() throws IOException {
  byte[] localBuf=buf;
  InputStream localIn=in;
  if (localBuf == null || localIn == null) {
    throw streamClosed();
  }
  if (pos >= count && fillbuf(localIn,localBuf) == -1) {
    return -1;
  }
  if (localBuf != buf) {
    localBuf=buf;
    if (localBuf == null) {
      throw streamClosed();
    }
  }
  if (count - pos > 0) {
    return localBuf[pos++] & 0xFF;
  }
  return -1;
}

@ Override public synchronized int read ( ) throws IOException { byte [ ] localBuf = buf ; InputStream localIn = in ; if ( localBuf == null || localIn == null ) { throw streamClosed ( ) ; } if ( pos >= count && fillbuf ( localIn , localBuf ) == - 1 ) { return - 1 ; } if ( localBuf != buf ) { localBuf = buf ; if ( localBuf == null ) { throw streamClosed ( ) ; } } if ( count - pos > 0 ) { return localBuf [ pos ++ ] & 0xFF ; } return - 1 ; }
reads a single byte from this stream and returns it as an integer in the range from 0 to 255 . returns - 1 if the end of the source string has been reached . if the internal buffer does not contain any available bytes then it is filled from the source stream and the first byte is returned .
