feat():测试
parent
3b9c9d0f6b
commit
955d634621
|
@ -25,7 +25,8 @@ public class OSSFileLoad {
|
||||||
// bucket
|
// bucket
|
||||||
private static final String bucketName = "java-web-generating-class";
|
private static final String bucketName = "java-web-generating-class";
|
||||||
// OSS文件路径
|
// OSS文件路径
|
||||||
private static final String filePath = "build/version/rule/";
|
private static final String fileJavaPath = "build/version/java/";
|
||||||
|
private static final String fileClassPath = "build/version/class/";
|
||||||
|
|
||||||
public static Result<Object> streamingDownload(String fileName) throws IOException {
|
public static Result<Object> streamingDownload(String fileName) throws IOException {
|
||||||
String source = null;
|
String source = null;
|
||||||
|
@ -37,7 +38,7 @@ public class OSSFileLoad {
|
||||||
System.out.println("bucket不存在");
|
System.out.println("bucket不存在");
|
||||||
return Result.error("bucket不存在");
|
return Result.error("bucket不存在");
|
||||||
}
|
}
|
||||||
Boolean flag_file = ossClient.doesObjectExist(bucketName, filePath+fileName+ MethodSuffix.JAVASUFFIX);
|
Boolean flag_file = ossClient.doesObjectExist(bucketName, fileJavaPath+fileName+ MethodSuffix.JAVASUFFIX);
|
||||||
if (!flag_file) {
|
if (!flag_file) {
|
||||||
System.out.println("预下载文件不存在");
|
System.out.println("预下载文件不存在");
|
||||||
return Result.error("预下载文件不存在");
|
return Result.error("预下载文件不存在");
|
||||||
|
@ -47,7 +48,7 @@ public class OSSFileLoad {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 从OSS下载文件
|
// 从OSS下载文件
|
||||||
InputStream inputStream = ossClient.getObject(bucketName, filePath + fileName + MethodSuffix.JAVASUFFIX).getObjectContent();
|
InputStream inputStream = ossClient.getObject(bucketName, fileJavaPath + fileName + MethodSuffix.JAVASUFFIX).getObjectContent();
|
||||||
File downloadFile = new File(localPath);
|
File downloadFile = new File(localPath);
|
||||||
FileOutputStream outputStream = new FileOutputStream(downloadFile);
|
FileOutputStream outputStream = new FileOutputStream(downloadFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue