3

I'm writing an ECL provider for use with CMIS repositories. In the getContent and getThumbnailImage methods I'm using a MemoryStream created with the CopyTo method from a BufferedStream.

From what I can tell my MemoryStream exists, it has a length roughly equal to the size of the object it represents and it returns true for CanSeek, CanRead and CanWrite.

However, when I use this stream GetThumbnailImage and GetContent are both not firing (or at least any exceptions I try to throw in them don't appear in Tridion).

To test if it's a problem with my code outside of the stream I've tried passing it a FileStream created from an image on my desktop and that is working with no problems.

Is there a problem with using MemoryStreams in general for these methods, or is it more likely a specific issue with my stream?

1

2 Answers 2

4

Have you tried setting the Position property of your stream to 0?

I've found that to be an issue with MemoryStreams in .NET generally in the past, however I've not tried one with ECL.

Though it seems to me if it is a subclass of Stream it should work by default.

0

You can use following to read the image in your repository API and return byte[]

Stream s;
byte[] b;

using (BinaryReader br = new BinaryReader(s))
{
    b = br.ReadBytes(s.Length);
}

as GetThubnailImage also need byte array.

 public byte[] GetThumbnailImage(IEclUri eclUri, int maxWidth, int maxHeight)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.