To convert com.aspose.slides.Presentation object to inputStream

Hi…

Can anyone please tell me how to convert com.aspose.slides.Presentation object to InputStream object??

Thanks in advance…

Dear Tapan,

Thanks for considering Aspose.Slides.

InputSteam and OuputStream are two abstract classes, means you cannot create their instances.

However, some classes have been derived from them and are concrete classes means you can create their instances.

For example, FileInputStream is one of concrete classes that have been derived from InputStream class.

And similarly, FileOutputStream is one of concrete classes that have been derived from OutputStream class.

Now, you can create a Presentation object from InputStream derived classes and also write Presentation object to OutputStream derived classes.

Please see these links.

http://www.aspose.com/documentation/file-format-components/aspose.slides-for-.net-and-java/opening-a-presentation.html

http://www.aspose.com/documentation/file-format-components/aspose.slides-for-.net-and-java/saving-a-presentation.html

Hey…

Thanks for the Reply.
This is what i have done to convert the Presentation object to inputstream object. I have used ByteArrayOutputStream class to do so.
This is my code:

ByteArrayOutputStream outStr= new ByteArrayOutputStream();
newPresentation.write(outStr);

ByteArrayInputStream pptInputStream = new ByteArrayInputStream(outStr.toByteArray());

return pptInputStream;


Thanks again…

Thanks for sharing the code example.