我遇到了一种情况,我需要打开驻留在 S3 存储桶中的 zip 文件。到目前为止我的代码如下:
public ZipFile readZipFile(String name) throws Exception {
GetObjectRequest req = new GetObjectRequest(settings.getAwsS3BatchRecogInBucketName(), name);
S3Object obj = s3Client.getObject(req);
S3ObjectInputStream is = obj.getObjectContent();
/******************************
* HOW TO DO
******************************/
return null;
}
Run Code Online (Sandbox Code Playgroud)
以前,我确实尝试使用File.createTempFile函数创建临时文件对象,但总是遇到无法创建 File 对象的问题。我之前的尝试如下:
public ZipFile readZipFile(String name) throws Exception {
GetObjectRequest req = new GetObjectRequest(settings.getAwsS3BatchRecogInBucketName(), name);
S3Object obj = s3Client.getObject(req);
S3ObjectInputStream is = obj.getObjectContent();
File temp = File.createTempFile(name, "");
temp.setWritable(true);
FileOutputStream fos = new FileOutputStream(temp);
fos.write(IOUtils.toByteArray(is));
fos.flush();
return new ZipFile(temp);
}
Run Code Online (Sandbox Code Playgroud)
有人遇到过这种情况吗?请给我建议谢谢:)
我是Elixir和Phoenix的新手(学习6个月),我想将一个Ecto模型的字段(不是主键或表ID)分配给MySql中的BIGINT。
我意识到,当您创建一个Ecto模型时,MySql表中该模型的ID将在迁移后自动映射到BIGINT。
检查完此站点后,我尝试在两个模型及其对应的迁移脚本中创建一个Ecto模型的字段到:integer或:id,但是在MySql中它始终为我提供INT数据类型。
谁知道Elixir或Ecto中与MySql中的BIGINT对应的数据类型是什么,所以当我执行迁移脚本时,我的表将具有该特定列作为BIGINT?
谢谢