@Override public int read(){
  if (currentPos < data.length) {
    return data[currentPos++];
  }
 else {
    if (!isFinal) {
      try {
        Thread.sleep(100);
      }
 catch (      InterruptedException e) {
      }
      return read();
    }
    return -1;
  }
}

@ Override public int read ( ) { if ( currentPos < data . length ) { return data [ currentPos ++ ] ; } else { if ( ! isFinal ) { try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { } return read ( ) ; } return - 1 ; } }
reads one byte of the stream
