• Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing a String to an InputStream()  RSS feed

 
Garandi Garandi
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a method which takes as it argument an InputStream. ie. parse(InputStream in).
But I have a String, I don't want to save the String into a file and pass it to my parse(InputStream in).
Question: How to convert a String to a Stream (InputStream)?
Thank you
Garandi
 
Rovas Kram
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
new ByteArrayInputStream(yourString.getBytes)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!