public void writePiece(Piece p) throws IOException{
		//if(!isPartial){throw new RuntimeException("Invalid use. I'm complete");}
		if(pieceIndexToOffSet.containsKey((int)p.pieceIndex)){throw new RuntimeException("Invalid piece is already contained.");}
		if(leftPiece<=p.pieceIndex && rightPiece>=p.pieceIndex){
			long pStart = (long)(p.pieceIndex*(long)pieceLength);//byte at which piece starts
			long fStart= pStart-byteOffSet; //file start - pieceStart
			long fEnd = pStart + pieceLength-byteOffSet;
			int offX=0;
			if(fEnd>length){
				fEnd = length;
			}
			if(fStart<0){
				offX=(int) Math.abs(fStart);
				fStart =0;
			}
			
			raf.seek(raf.length());
			raf.writeInt((int)p.pieceIndex);
			long pt = raf.getFilePointer();
			raf.write(p.finalPiece, offX, (int)(fEnd-fStart));
			//check if complete. If it is change status.
			pieceIndexToOffSet.put((int)p.pieceIndex, pt);
			if(numPieces == pieceIndexToOffSet.size()){
				//Complete. 
				//Do our close out.
				doCloseOut();
			}
		}
	}