赞
踩
- /**
- * 获取流
- * @param
- * @param bucketName
- * @param objectKey
- */
- @Override
- public void getViewStream(HttpServletResponse response, String bucketName, String objectKey) {
- AmazonS3 s3 = oosUtils.getAmazonS3();
- try {
- GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, objectKey);
- S3Object o = s3.getObject(getObjectRequest);
- S3ObjectInputStream s3is = o.getObjectContent();
- response.setContentType("video/mp4");
- response.addHeader("Content-Type", "audio/mp4;charset=UTF-8");
- IOUtils.copy(s3is, response.getOutputStream());
- response.flushBuffer();
- }
- catch (AmazonServiceException | IOException e) {
- System.err.println(e.getMessage());
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。