public synchronized byte[] readNextPart(String username) throws JPlagException {
  TransferObject obj=userToDownloadMap.get(username);
  if (obj == null) {
    throw new JPlagException("downloadException","No download started or download timed out!","Restart the download");
  }
  downloadTimeoutQueue.remove(obj);
  byte[] data=obj.readNextPart();
  if (obj.getRemainingBytes() != 0) {
    obj.setTimeout(120);
    downloadTimeoutQueue.add(obj);
  }
 else {
    userToDownloadMap.remove(username);
    JPlagCentral.cancelSubmission(obj.getStruct());
  }
  return data;
}

public synchronized byte [ ] readNextPart ( String username ) throws JPlagException { TransferObject obj = userToDownloadMap . get ( username ) ; if ( obj == null ) { throw new JPlagException ( "downloadException" , "No download started or download timed out!" , "Restart the download" ) ; } downloadTimeoutQueue . remove ( obj ) ; byte [ ] data = obj . readNextPart ( ) ; if ( obj . getRemainingBytes ( ) != 0 ) { obj . setTimeout ( 120 ) ; downloadTimeoutQueue . add ( obj ) ; } else { userToDownloadMap . remove ( username ) ; JPlagCentral . cancelSubmission ( obj . getStruct ( ) ) ; } return data ; }
reads the next part of the download identified by the username . if it was the last part it unmarks the user and deletes the entry file
