public static void multipartUploadObejctByMultithreading(KS3Client client,
			InputStream inputstream, long offset, long length, String bucketName,
			String objectKey,String mimeType) throws Exception {

		// 要上传到文件至少要一个Part的大小
		if (length < PART_SIZE)
			throw new IllegalArgumentException(
					"The object you are trying to upload is not large as a PART_SIZE.");

		// 起始位置不能在length之后
		if (offset < 0 || offset > length)
			throw new IllegalArgumentException("Illegal arguments");
		
		//得到实际的length
		length = length - offset;
		
		//处理偏移量
		try {
			inputstream.skip(offset);
		} catch (Exception e) {
			e.printStackTrace();
			throw new Exception("Skip data failed.");
		}

		// 计算上传的块的数量
		int partCount = (int) (length / PART_SIZE);
		if (length % PART_SIZE != 0)
			partCount++;

		// 初始化一个指定数量线程的线程池，并构造一个线程安全到list承载上传列表的相关信息
		ExecutorService threadPool = Executors.newFixedThreadPool(CONCURRENCIES);
		List<UploadPart> partList = Collections.synchronizedList(new ArrayList<UploadPart>());

		// 初始化一个上传会话
		InitiateMultipartUploadResult imur = client.initiateMultipartUpload(bucketName, objectKey,mimeType);
		String uploadId = imur.getUploadId();
		
		// 一次性读到内存，然后多线程同时上传
		CopyInputStream copy = new CopyInputStream(inputstream);
		
		System.out.println("[Upload start.]");

		//依次启动在线程池内启动线程
		for (int i = 0; i < partCount; i++) {
			
			long start = PART_SIZE * i;
			long currentPartSize = PART_SIZE < length - start ? PART_SIZE : length - start;

			InputStream inputstreamCopy = copy.getCopy();
			
			threadPool.execute(new UploadPartThread(start, bucketName,
					objectKey, uploadId, i+1, currentPartSize, inputstreamCopy,client, partList));
		}		
		
		//等待全部线程执行结束
		threadPool.shutdown();
		while (!threadPool.isTerminated()) {
			threadPool.awaitTermination(5, TimeUnit.SECONDS);
        }
		
		//上传失败
		if (partList.size() != partCount){
			AbortMultipartUploadOptions abortMultipartUploadOptions = new AbortMultipartUploadOptions(bucketName, objectKey, uploadId);
			client.abortMultipartUpload(abortMultipartUploadOptions);
			throw new Exception("[Upload failed.]");
			
		}
		//上传成功
		else{		
			
			//把partNum排序
	        Collections.sort(partList, new Comparator<UploadPart>(){
	            public int compare(UploadPart arg0, UploadPart arg1) {
	            	UploadPart part1= arg0;
	            	UploadPart part2= arg1;

	                return part1.getPartNumber() - part2.getPartNumber();
	            }  
	        });
			
			CompleteMultipartUploadOptions completeMultipartUploadOptions = new CompleteMultipartUploadOptions(bucketName, objectKey, uploadId, partList);
			client.completeMultipartUpload(completeMultipartUploadOptions);
			System.out.println("[Upload Suceess.]");		
		}		
	}