public void waitUntilAllReceived ( int timeout ) throws ExternalFrameConfirmationException { try { byte flag = ExternalFrameConfirmationCheck . getConfirmation ( ab , timeout ) ; assert ( flag == ExternalFrameHandler . CONFIRM_READING_DONE ) ; } catch ( TimeoutException ex ) { throw new ExternalFrameConfirmationException ( "Timeout for confirmation exceeded!" ) ; } catch ( InterruptedException e ) { throw new ExternalFrameConfirmationException ( "Confirmation thread interrupted!" ) ; } catch ( ExecutionException e ) { throw new ExternalFrameConfirmationException ( "Confirmation failed!" ) ; } }
This method ensures the application waits for all bytes to be received before continuing in the application s control flow .