Exemplo n.º 1
0
 @Override
 public ContentStream getContent(StoredObject so, long offset, long length) {
   if (so instanceof Content) {
     Content content = (Content) so;
     ContentStream contentStream = content.getContent();
     if (null == contentStream) {
       return null;
     } else if (offset <= 0 && length < 0) {
       return contentStream;
     } else {
       return ((ContentStreamDataImpl) contentStream).getCloneWithLimits(offset, length);
     }
   } else {
     throw new CmisInvalidArgumentException(
         "Cannot set content, object does not implement interface Content.");
   }
 }
Exemplo n.º 2
0
  @Override
  public void appendContent(StoredObject so, ContentStream contentStream) {
    if (so instanceof Content) {
      Content content = (Content) so;
      ContentStreamDataImpl newContent = (ContentStreamDataImpl) content.getContent();

      if (null == newContent) {
        content.setContent(null);
      } else {
        try {
          newContent.appendContent(contentStream.getStream());
        } catch (IOException e) {
          throw new CmisStorageException("Failed to append content: IO Exception", e);
        }
      }
    } else {
      throw new CmisInvalidArgumentException(
          "Cannot set content, object does not implement interface Content.");
    }
  }