You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Adam Lally <al...@alum.rpi.edu> on 2010/08/22 22:24:54 UTC

Re: XmiCasDeserializer.deserialize with InputSource rather than InputStream

On Sun, Aug 22, 2010 at 8:52 AM, John Wiesel <jo...@fu-berlin.de>wrote:

> Dear all,
>
> I am currently stalled in my project by XmiCasDeserializer.deserialize: I
> am wondering why there is no method that allows to directly set up the XML
> parser with a InputSource instead of an InputStream. I would like to load
> my CAS from an XMI file that I have cached in a CharArray. As I cannot
> generate an InputStream from a String (StringBufferInputStream is
> deprecated since JDK 1.1) but should be able to do so using an InputSource
> w/o much trouble, I hope there is a sensible solution for this that I just
> haven't thought of yet.
>
>
To get an InputStream from a String, you can convert the String to bytes,
using for example:
 String.getBytes("UTF-8")

and then use a ByteArrayInputStream.

 -Adam