convert string to inputstream

I have a String =" abcdefghij ......"

How can I put into an InputStream.

TLTEOAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
kotanConnect With a Mentor Commented:
Use String Reader,

InputStream is = new StringReader(strdata)
0
 
TLTEOAuthor Commented:
InputStream is=new StringBufferInputStream(strdata);

is deprecated.

What is the new way ??
0
 
kotanCommented:
According jdk docs,

StringBufferInputStream class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class.
0
 
TLTEOAuthor Commented:
tks vm . Cheers
0
 
TLTEOAuthor Commented:
wrong I am getting error

found   : java.io.StringReader
required: java.io.InputStream
InputStream certfis=new StringReader(strdata);
                    ^
cud you pls verify
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.