Link to home
Start Free TrialLog in
Avatar of TLTEO
TLTEO

asked on

convert string to inputstream

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

How can I put into an InputStream.

Avatar of TLTEO
TLTEO

ASKER

InputStream is=new StringBufferInputStream(strdata);

is deprecated.

What is the new way ??
ASKER CERTIFIED SOLUTION
Avatar of kotan
kotan
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of TLTEO

ASKER

tks vm . Cheers
Avatar of TLTEO

ASKER

wrong I am getting error

found   : java.io.StringReader
required: java.io.InputStream
InputStream certfis=new StringReader(strdata);
                    ^
cud you pls verify