private void handleEndOfStream(State state,InnerState innerState) throws StopRequest {
  mInfo.mCurrentBytes=innerState.mBytesSoFar;
  mDB.updateDownload(mInfo);
  boolean lengthMismatched=(innerState.mHeaderContentLength != null) && (innerState.mBytesSoFar != Integer.parseInt(innerState.mHeaderContentLength));
  if (lengthMismatched) {
    if (cannotResume(innerState)) {
      throw new StopRequest(DownloaderService.STATUS_CANNOT_RESUME,"mismatched content length");
    }
 else {
      throw new StopRequest(getFinalStatusForHttpError(state),"closed socket before end of file");
    }
  }
}

private void handleEndOfStream ( State state , InnerState innerState ) throws StopRequest { mInfo . mCurrentBytes = innerState . mBytesSoFar ; mDB . updateDownload ( mInfo ) ; boolean lengthMismatched = ( innerState . mHeaderContentLength != null ) && ( innerState . mBytesSoFar != Integer . parseInt ( innerState . mHeaderContentLength ) ) ; if ( lengthMismatched ) { if ( cannotResume ( innerState ) ) { throw new StopRequest ( DownloaderService . STATUS_CANNOT_RESUME , "mismatched content length" ) ; } else { throw new StopRequest ( getFinalStatusForHttpError ( state ) , "closed socket before end of file" ) ; } } }
called when we ' ve reached the end of the http response stream , to update the database and check for consistency .
