AWS php sdk即时写入s3bucket

时间:2017-01-18 05:02:38

标签: php amazon-s3 stream cakephp-3.0 zipstream

我想将s3 bucket1中的一些文件(视频)写入s3bucket2作为邮件,而不使用任何磁盘空间进行临时存储。它应该在最短的时间内以较少的开销发生。目前我正在使用zipstream制作zip,但是无法快速写入存储桶。任何帮助都是预先确定的。

1 个答案:

答案 0 :(得分:0)

是的,你可以。如果您将对象作为字符串存储在内存中,只需使用public class MyRecyclerViewAdapter extends RecyclerView.Adapter<MyRecyclerViewAdapter.CustomViewHolder> { private List<SingleItemModel> singleItemList; private Context mContext; private OnItemClickListener onItemClickListener; public MyRecyclerViewAdapter(Context context, List<SingleItemModel> singleItemList) { this.singleItemList = singleItemList; this.mContext = context; } @Override public CustomViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_row, null); CustomViewHolder viewHolder = new CustomViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(CustomViewHolder customViewHolder, int i) { final SingleItemModel feedItem = singleItemList.get(i); //Download image using picasso library if (!TextUtils.isEmpty(feedItem.getUrl())) { Picasso.with(mContext).load(feedItem.getUrl()) .error(R.drawable.placeholder) .placeholder(R.drawable.placeholder) .into(customViewHolder.imageView); } //Setting text view title customViewHolder.textView.setText(feedItem.getName()); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { onItemClickListener.onItemClick(feedItem); } }; customViewHolder.imageView.setOnClickListener(listener); customViewHolder.textView.setOnClickListener(listener); } @Override public int getItemCount() { return (null != singleItemList ? singleItemList.size() : 0); } class CustomViewHolder extends RecyclerView.ViewHolder { protected ImageView imageView; protected TextView textView; public CustomViewHolder(View view) { super(view); this.imageView = (ImageView) view.findViewById(R.id.thumbnail); this.textView = (TextView) view.findViewById(R.id.title); } } public OnItemClickListener getOnItemClickListener() { return onItemClickListener; } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { this.onItemClickListener = onItemClickListener; }

file_put_contents

这完全合法,因为PHP SDK支持支持流包装:http://docs.aws.amazon.com/aws-sdk-php/v2/guide/feature-s3-stream-wrapper.html