All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jeesuite.filesystem.utils.HttpDownloader Maven / Gradle / Ivy

There is a newer version: 1.3.6
Show newest version
/**
 * 
 */
package com.jeesuite.filesystem.utils;

import java.io.IOException;

import com.jeesuite.filesystem.UploadObject;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;


public class HttpDownloader {

	private static OkHttpClient httpClient = new OkHttpClient();
	
	public static UploadObject read(String url) throws IOException{
		
		Request.Builder requestBuilder = new Request.Builder().url(url);
		Response response = httpClient.newCall(requestBuilder.build()).execute();
		
		UploadObject item = new UploadObject(FilePathHelper.parseFileName(url), response.body().bytes());
		return item;
	}
	
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy