类 OSSClient

  • 所有已实现的接口:
    xin.manong.weapon.base.rebuild.Rebuildable

    public class OSSClient
    extends Object
    implements xin.manong.weapon.base.rebuild.Rebuildable
    OSS客户端
    作者:
    frankcl
    • 方法详细资料

      • close

        public void close()
        关闭客户端实例
      • rebuild

        public void rebuild()
        指定者:
        rebuild 在接口中 xin.manong.weapon.base.rebuild.Rebuildable
      • getObject

        public byte[] getObject​(String bucket,
                                String key)
        获取数据
        参数:
        bucket -
        key -
        返回:
        如果成功返回内容,否则返回null
      • putObject

        public boolean putObject​(String bucket,
                                 String key,
                                 byte[] content)
        上传数据
        参数:
        bucket -
        key -
        content - 内容
        返回:
        成功返回true,否则返回false
      • putObject

        public boolean putObject​(String bucket,
                                 String key,
                                 InputStream inputStream)
        上传数据
        参数:
        bucket -
        key -
        inputStream - 输入流
        返回:
        成功返回true,否则返回false
      • deleteObject

        public void deleteObject​(String bucket,
                                 String key)
        删除数据
        参数:
        bucket - bucket
        key - key
      • getObjectMeta

        public com.aliyun.oss.model.ObjectMetadata getObjectMeta​(String bucket,
                                                                 String key)
        获取数据信息
        参数:
        bucket -
        key -
        返回:
        成功返回数据信息,否则返回null
      • list

        public List<String> list​(String bucket,
                                 String directory)
        列表目录文件 最多不超过10000个文件
        参数:
        bucket -
        directory - 目录
        返回:
        成功返回key列表,否则返回null
      • sign

        public String sign​(String bucket,
                           String key)
        数据加签,过期时间1小时
        参数:
        bucket -
        key -
        返回:
        加签URL
      • sign

        public String sign​(String bucket,
                           String key,
                           long ttl)
        数据加签
        参数:
        bucket -
        key -
        ttl - 过期时间(毫秒)
        返回:
        加签URL
      • exist

        public boolean exist​(String bucket,
                             String key)
        数据是否存在
        参数:
        bucket -
        key -
        返回:
        存在返回true,否则返回false