当前位置:网站首页>阿里OSS对象存储服务
阿里OSS对象存储服务
2022-06-24 13:04:00 【知之为知】
阿里云对象存储服务(Object Storage Service,简称OSS)
参考阿里OSS对象存储服务快速入门文档:
1.引入依赖
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
</dependency>
2.OSS控制台创建存储空间
在上传文件(Object)到OSS之前,您需要创建一个用于存储文件的存储空间(Bucket)
3.流式上传的方式将文件上传到OSS
见产品文档
4.通过流式下载方式从OSS下载文件
见产品文档
5.传输对象、解析对象
①将对象parse为JSON上传
Dog dog = new Dog("小黄", 2);
String jsonStr = JSON.toJSONString(dog);
ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(jsonStr.getBytes()));
②下载JSON并parse为对象
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();
}
边栏推荐
猜你喜欢

tongweb使用之端口冲突处理办法

One click to generate University, major and even admission probability. Is it so magical for AI to fill in volunteer cards?
![[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX](/img/d1/4b21c8049f0377b54a18a9b267432e.png)
[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX

港股上市公司公告 API 数据接口

How to solve the problem that iterative semi supervised training is difficult to implement in ASR training? RTC dev Meetup

PgSQL queries the largest or smallest data of a field in a group

A review of text contrastive learning

Go language concurrency model mpg model

postgresql之List

厨卫电器行业B2B交易协同管理平台开发,优化企业库存结构
随机推荐
v-if 和 v-show 的区别
GO语言-goroutine协程的使用
Baidu map API drawing points and tips
Go language -init() function - package initialization
Development of digital Tibetan product system NFT digital Tibetan product system exception handling source code sharing
专精特新“小巨人”再启动,“企业上云”数字赋能
Common singleton mode & simple factory
【环境搭建】zip 分卷压缩
Unity 热力图建立方法
3环杀掉360安全卫士进程
Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]
`Thymeleaf ` template engine comprehensive analysis
Development of B2B transaction collaborative management platform for kitchen and bathroom electrical appliance industry and optimization of enterprise inventory structure
Return to new list
鲲鹏arm服务器编译安装PaddlePaddle
[untitled]
Rongyun communication has "hacked" into the heart of the bank
The "little giant" specialized in special new products is restarted, and the "enterprise cloud" digital empowerment
[leetcode] 10. Regular expression matching
Defeat the binary tree!