void writeInitData ( final BluetoothGattCharacteristic characteristic , final CRC32 crc32 ) throws DfuException , DeviceDisconnectedException , UploadAbortedException { try { byte [ ] data = mBuffer ; int size ; while ( ( size = mInitPacketStream . read ( data , 0 , data . length ) ) != - 1 ) { writeInitPacket ( characteristic , data , size ) ; if ( crc32 != null ) crc32 . update ( data , 0 , size ) ; } } catch ( final IOException e ) { loge ( "Error while reading Init packet file" , e ) ; throw new DfuException ( "Error while reading Init packet file" , DfuBaseService . ERROR_FILE_ERROR ) ; } }
Wends the whole init packet stream to the given characteristic .