protected int readApplicationData(byte[] buf,int offset,int len) throws IOException {
  if (len < 1) {
    return 0;
  }
  while (applicationDataQueue.available() == 0) {
    if (this.closed) {
      if (this.failedWithError) {
        throw new IOException(TLS_ERROR_MESSAGE);
      }
      return -1;
    }
    safeReadRecord();
  }
  len=Math.min(len,applicationDataQueue.available());
  applicationDataQueue.removeData(buf,offset,len,0);
  return len;
}

protected int readApplicationData ( byte [ ] buf , int offset , int len ) throws IOException { if ( len < 1 ) { return 0 ; } while ( applicationDataQueue . available ( ) == 0 ) { if ( this . closed ) { if ( this . failedWithError ) { throw new IOException ( TLS_ERROR_MESSAGE ) ; } return - 1 ; } safeReadRecord ( ) ; } len = Math . min ( len , applicationDataQueue . available ( ) ) ; applicationDataQueue . removeData ( buf , offset , len , 0 ) ; return len ; }
read data from the network . the method will return immediately , if there is still some data left in the buffer , or block until some application data has been read from the network .
