当前位置:网站首页>阿里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();
}
边栏推荐
- Go language - use of goroutine coroutine
- 探索云原生数据库,纵观未来科技发展
- Second, the examinee must see | consolidate the preferred question bank to help the examinee make the final dash
- Rongyun communication has "hacked" into the heart of the bank
- Idea connection MySQL custom generated entity class code
- 成功解决:selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This versi
- 21set classic case
- Development of digital Tibetan product system NFT digital Tibetan product system exception handling source code sharing
- P2pdb white paper
- puzzle(016.2)指画星河
猜你喜欢
![Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]](/img/f7/8d026c0e4435fc8fd7a63616b4554d.png)
Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]

常见的单例模式&简单工厂

日常知识科普

在宇宙的眼眸下,如何正确地关心东数西算?

卷积核、特征图可视化

leetcode.12 --- 整数转罗马数字

`Thymeleaf`模板引擎全面解析

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

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

puzzle(016.2)指画星河
随机推荐
六月集训(第24天) —— 线段树
业务与技术双向结合构建银行数据安全管理体系
Online text entity extraction capability helps applications analyze massive text data
Solution of channel management system for food and beverage industry: realize channel digital marketing layout
win10系统问题
数字臧品系统开发 NFT数字臧品系统异常处理源码分享
box-sizing
Linux 安装 CenOS7 MySQL - 8.0.26
Three efficient programming skills of go language
SAP Marketing Cloud 功能概述(三)
c语言---18 函数(自定义函数)
厨卫电器行业B2B交易协同管理平台开发,优化企业库存结构
Mit-6.824-lab4a-2022 (ten thousand words explanation - code construction)
卷积核、特征图可视化
3环杀掉360安全卫士进程
[untitled]
leetcode.12 --- 整数转罗马数字
Generate binary tree according to preorder & inorder traversal [partition / generation / splicing of left subtree | root | right subtree]
探索云原生数据库,纵观未来科技发展
box-sizing