コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.magnum.dataup.service.VideoService#getVideoData(long,
  * java.io.OutputStream)
  */
 @Override
 public void getVideoData(long id, OutputStream outputStream) {
   Video video = getVideo(id);
   if (video == null) {
     throw new VideoNotFoundException(String.format("Video does not exists for id=%s", id));
   } else if (!videoFileManager.hasVideoData(video)) {
     throw new VideoDataNotFoundException(String.format("Video data not found for id=%s", id));
   }
   try {
     videoFileManager.copyVideoData(video, outputStream);
   } catch (IOException e) {
     throw new VideoServiceException(
         String.format("Error copying file to outputStream for id %s", id), e);
   }
 }
コード例 #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.magnum.dataup.service.VideoService#saveVideoData(long,
  * java.io.InputStream)
  */
 @Override
 public void saveVideoData(long id, InputStream videoData) {
   Video video = getVideo(id);
   if (video == null) {
     throw new VideoNotFoundException(String.format("Video does not exists for id=%s", id));
   }
   try {
     videoFileManager.saveVideoData(video, videoData);
   } catch (IOException e) {
     throw new VideoServiceException(String.format("Error saving video to file for id %s", id), e);
   }
 }
コード例 #3
0
 @PostConstruct
 public void init() throws IOException {
   videoFileManager = VideoFileManager.get();
   videos = new ArrayList<Video>();
 }