阿里的oss平台获取文件按行读取放入list集合

/*从0ss平台获取文件内容,下面参数endpoint ,accesskeyId, bucketName交换平台可以取到 
* String endpoint ="http://oss-cn-chengdu-senx-do1-a.dev_cloud.sorcu-inc.coml";
String accesskeyId ="xgitgH66vz5s....."
String accesskeySecret ="F9EdSM3erHrIlUyQu1hZ7........";
String bucketName ="oss-cms-tbsp-deve1";
String _ossFilePath ="TBSP/sync/scgec/20210514/20210514_@1_0EC8811_q_81.dat";
* ossFiLePath。去0SS平台取文件的路径包括文件名*/
public List<string> getEielListFromoss(string ossFilePath){
		//从OSS平台获取文件
		String endpoint = fileConfig.getEndpoint()String accesskeyId =fileconfig.getAccessKeyId();
		String accesskeysecret =fileConfig.getAccesskeySecret();
		String bucketName = fileConfig.getBucketName();
		//创建o5S实例
		Oss ossclient = new OssclientBuilder().build(endpoint,laccessKeyId, accessKeySecret);
		//获取文件
		OSsobject object = ossclient.getobject(bucketName, ossFitepath);
		//文件生成流
		Inputstream in = object.getobjectContent()//将流按行放入到list集合
		List vist = new AnnayListO;
		try {
			Toutil.neaduines(in,charsetName:"utf-8", list);
		} catch (Exception e){
			throw new IORuntimeException(e);
		} finally {
			Ioutil.close(in);
		}
		ossCtient.shutdown();
		//System.out.printin(list);
		return ist;
	}
}

你可能感兴趣的:(Java面试)