当前位置:网站首页>Alibaba OSS object storage service
Alibaba OSS object storage service
2022-06-24 14:25:00 【Knowing is knowing】
Alibaba cloud object storage service (Object Storage Service, abbreviation OSS)
Refer to Ali OSS Object storage services quick start documentation :
1. Introduce dependencies
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
2.OSS Console create storage space
Uploading files (Object) To OSS Before , You need to create a storage space for storing files (Bucket)
3. Upload files to by streaming upload OSS
See product documentation
4. Stream download from OSS Download the file
See product documentation
5. Transfer object 、 Parse object
① Put the object parse by JSON Upload
Dog dog = new Dog(" Xiao Huang ", 2);
String jsonStr = JSON.toJSONString(dog);
ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(jsonStr.getBytes()));
② download JSON and parse As object
OSSObject ossObject = ossClient.getObject(bucketName, objectName);
InputStream content = ossObject.getObjectContent();
if (content != null) {
Dog dog = JSON.parseObject(content, Dog.class);
System.out.println(dog.getName() + "-" + dog.getAge());
content.close();
}
边栏推荐
- SSH keygen configuration does not require entering a password every time
- GO语言并发模型-MPG模型
- [environment setup] zip volume compression
- Halcon 绘制区域 到图片中
- Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]
- Research on MySQL composite index
- laravel8使用faker调用工厂填充数据
- June training (day 24) - segment tree
- Idea connection MySQL custom generated entity class code
- 港股上市公司公告 API 数据接口
猜你喜欢

Port conflict handling method for tongweb

Development of digital Tibetan product system NFT digital Tibetan product system exception handling source code sharing

Virtual machines on the same distributed port group but different hosts cannot communicate with each other

Go language - use of goroutine coroutine

如何避免下重复订单

【从零开始学zabbix】一丶Zabbix的介绍与部署Zabbix

Daily knowledge popularization

Development of B2B transaction collaborative management platform for kitchen and bathroom electrical appliance industry and optimization of enterprise inventory structure

Successfully solved: selenium common. exceptions. SessionNotCreatedException: Message: session not created: This versi

Overview of SAP marketing cloud functions (III)
随机推荐
Maximum path sum in binary tree [handle any subtree, then handle the whole tree]
Database considerations
Defeat the binary tree!
Three efficient programming skills of go language
laravel 8 实现Auth登录
【从零开始学zabbix】一丶Zabbix的介绍与部署Zabbix
Jupyter notebook操作
Method of establishing unity thermodynamic diagram
conda和pip命令
厨卫电器行业B2B交易协同管理平台开发,优化企业库存结构
R语言plotly可视化:使用plotly可视化数据划分后的训练集和测试集、使用不同的形状标签表征、训练集、测试集、以及数据集的分类标签(Display training and test split
15 differences between MES in process and discrete manufacturing enterprises (Part 2)
【Pytorch】量化
数据库一些基本操作(提供了原数据库信息)
打败 二叉树!
Jupiter notebook operation
第八章 操作位和位串(四)
A review of text contrastive learning
laravel下视图间共享数据
The difference between V-IF and v-show