gpt4 book ai didi

com.qiniu.common.Zone类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 10:54:49 28 4
gpt4 key购买 nike

本文整理了Java中com.qiniu.common.Zone类的一些代码示例,展示了Zone类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zone类的具体详情如下:
包路径:com.qiniu.common.Zone
类名称:Zone

Zone介绍

[英]多区域上传域名
[中]多区域上传域名

代码示例

代码示例来源:origin: Exrick/x-boot

/**
 * 构造一个带指定Zone对象的配置类 zone2华南
 */
public Configuration getConfiguration(){
  Configuration cfg = null;
  if(zone.equals(0)){
    cfg = new Configuration(Zone.zone0());
  }else if(zone.equals(1)){
    cfg = new Configuration(Zone.zone1());
  }else if(zone.equals(2)){
    cfg = new Configuration(Zone.zone2());
  }else if(zone.equals(3)){
    cfg = new Configuration(Zone.zoneNa0());
  }else if(zone.equals(4)){
    cfg = new Configuration(Zone.zoneAs0());
  }else {
    cfg = new Configuration(Zone.autoZone());
  }
  return cfg;
}

代码示例来源:origin: qiniu/java-sdk

public String upHost(String upToken) throws QiniuException {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(upToken);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getUpHttps(zoneReqInfo)
      : zone.getUpHttp(zoneReqInfo);
}

代码示例来源:origin: qiniu/java-sdk

public String upHostBackup(String upToken) throws QiniuException {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(upToken);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getUpBackupHttps(zoneReqInfo)
      : zone.getUpBackupHttp(zoneReqInfo);
}

代码示例来源:origin: qiniu/java-sdk

@Test
public void testHello2() {
  Map<String, Zone> bucketKeyMap = new HashMap<String, Zone>();
  bucketKeyMap.put(TestConfig.testBucket_z0, Zone.zone0());
  bucketKeyMap.put(TestConfig.testBucket_na0, Zone.zoneNa0());
  for (Map.Entry<String, Zone> entry : bucketKeyMap.entrySet()) {
    String bucket = entry.getKey();
    Zone zone = entry.getValue();
    Configuration c = new Configuration(zone);
    c.useHttpsDomains = true;
    UploadManager uploadManager = new UploadManager(c);
    hello(uploadManager, bucket);
  }
}

代码示例来源:origin: vakinge/jeesuite-libs

public QiniuProvider(String urlprefix, String bucketName, String accessKey, String secretKey,boolean isPrivate) {
  
  Validate.notBlank(bucketName, "[bucketName] not defined");
  Validate.notBlank(accessKey, "[accessKey] not defined");
  Validate.notBlank(secretKey, "[secretKey] not defined");
  Validate.notBlank(urlprefix, "[urlprefix] not defined");
  
  this.urlprefix = urlprefix.endsWith(DIR_SPLITER) ? urlprefix : urlprefix + DIR_SPLITER;
  this.bucketName = bucketName;
  auth = Auth.create(accessKey, secretKey);
  Zone z = Zone.autoZone();
  Configuration c = new Configuration(z);
  uploadManager = new UploadManager(c);
  bucketManager = new BucketManager(auth,c);
  
  this.isPrivate = isPrivate;
  this.host = StringUtils.remove(urlprefix,"/").split(":")[1];
}

代码示例来源:origin: qiniu/java-sdk

@Test
public void testAvthumb() {
  Map<String, Zone> cases = new HashMap<String, Zone>();
  cases.put(TestConfig.testBucket_z0, Zone.zone0());
  cases.put(TestConfig.testBucket_na0, Zone.zoneNa0());
  cases.put(TestConfig.testBucket_z0, Zone.autoZone());
  cases.put(TestConfig.testBucket_na0, Zone.autoZone());

代码示例来源:origin: com.qiniu/qiniu-java-sdk

public String rsHost(String ak, String bucket) {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(ak, bucket);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getRsHttps(zoneReqInfo)
      : zone.getRsHttp(zoneReqInfo);
}

代码示例来源:origin: qiniu/java-sdk

public String ioHost(String ak, String bucket) {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(ak, bucket);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getIovipHttps(zoneReqInfo)
      : zone.getIovipHttp(zoneReqInfo);
}

代码示例来源:origin: qiniu/java-sdk

public String rsfHost(String ak, String bucket) {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(ak, bucket);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getRsfHttps(zoneReqInfo)
      : zone.getRsfHttp(zoneReqInfo);
}

代码示例来源:origin: qiniu/java-sdk

public String apiHost(String ak, String bucket) {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(ak, bucket);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getApiHttps(zoneReqInfo)
      : zone.getApiHttp(zoneReqInfo);
}

代码示例来源:origin: nice-swa/my-site

public String upload(MultipartFile file, String fileName) {
  //构造一个带指定Zone对象的配置类
  Configuration cfg = new Configuration(Zone.zone0());
  //...其他参数参考类注释
  UploadManager uploadManager = new UploadManager(cfg);
  //默认不指定key的情况下,以文件内容的hash值作为文件名
  String key = null;
  Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
  String upToken = auth.uploadToken(BUCKET);
  try {
    Response response = null;
    response = uploadManager.put(file.getInputStream(), fileName, upToken, null, null);
    //解析上传成功的结果
    DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
    System.out.println(putRet.key);
    System.out.println(putRet.hash);
    return putRet.key;
  } catch (QiniuException ex) {
    Response r = ex.response;
    System.err.println(r.toString());
    try {
      System.err.println(r.bodyString());
    } catch (QiniuException ex2) {
      //ignore
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return null;
}

代码示例来源:origin: qiniu/java-sdk

@Test
  public void testZ() {
    Zone z1 = new Zone.Builder(Zone.zone0()).upHttp("http://uphttp").build();
    Assert.assertSame(z1.getUpHttp(null), "http://uphttp");
    Assert.assertSame(Zone.zone0().getUpHttp(null), "http://up.qiniu.com");
  }
}

代码示例来源:origin: qiniu/java-sdk

/**
 * 北美机房相关域名
 */
public static Zone beimei() {
  return zoneNa0();
}

代码示例来源:origin: qiniu/java-sdk

/**
 * 华北机房相关域名
 */
public static Zone huabei() {
  return zone1();
}

代码示例来源:origin: qiniu/java-sdk

/**
 * 华南机房相关域名
 */
public static Zone huanan() {
  return zone2();
}

代码示例来源:origin: qiniu/java-sdk

/**
 * 新加坡机房相关域名
 */
public static Zone xinjiapo() {
  return zoneAs0();
}

代码示例来源:origin: qiniu/java-sdk

public void testFormLargeSize2() {
  Map<String, Zone> bucketKeyMap = new HashMap<String, Zone>();
  bucketKeyMap.put(TestConfig.testBucket_z0, Zone.zone0());
  bucketKeyMap.put(TestConfig.testBucket_na0, Zone.zoneNa0());
  for (Map.Entry<String, Zone> entry : bucketKeyMap.entrySet()) {
    String bucket = entry.getKey();
    Configuration c = new Configuration(zone);
    c.putThreshold = 25 * 1024 * 1024;
    UploadManager uploadManager = new UploadManager(new Configuration(Zone.zone0()));

代码示例来源:origin: Jamling/SmartIM

zone == null ? Zone.autoZone() : zone);

代码示例来源:origin: com.qiniu/qiniu-java-sdk

public String upHostBackup(String upToken) throws QiniuException {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(upToken);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getUpBackupHttps(zoneReqInfo)
      : zone.getUpBackupHttp(zoneReqInfo);
}

代码示例来源:origin: qiniu/java-sdk

public String rsHost(String ak, String bucket) {
  ZoneReqInfo zoneReqInfo = new ZoneReqInfo(ak, bucket);
  if (zone == null) {
    zone = Zone.autoZone();
  }
  return useHttpsDomains ? zone.getRsHttps(zoneReqInfo)
      : zone.getRsHttp(zoneReqInfo);
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com