public synchronized void writeNextPart(String username,byte[] data) throws JPlagException {
  TransferObject obj=userToUploadMap.get(username);
  if (obj == null) {
    throw new JPlagException("uploadException","No upload started " + "or upload timed out!","Restart the upload");
  }
  uploadTimeoutQueue.remove(obj);
  if (!obj.writeNextPart(data)) {
    obj.setTimeout(120);
    uploadTimeoutQueue.add(obj);
  }
 else {
    userToUploadMap.remove(username);
    JPlagCentral.addToReadyQueue(obj.getStruct());
  }
}

public synchronized void writeNextPart ( String username , byte [ ] data ) throws JPlagException { TransferObject obj = userToUploadMap . get ( username ) ; if ( obj == null ) { throw new JPlagException ( "uploadException" , "No upload started " + "or upload timed out!" , "Restart the upload" ) ; } uploadTimeoutQueue . remove ( obj ) ; if ( ! obj . writeNextPart ( data ) ) { obj . setTimeout ( 120 ) ; uploadTimeoutQueue . add ( obj ) ; } else { userToUploadMap . remove ( username ) ; JPlagCentral . addToReadyQueue ( obj . getStruct ( ) ) ; } }
writes the next part of the upload identified by the username . if it was the last part it unmarks the user and adds the submission to the ready queue
