?
Solved

convert string to inputstream

Posted on 2001-09-11
5
Medium Priority
?
419 Views
Last Modified: 2008-02-01
I have a String =" abcdefghij ......"

How can I put into an InputStream.

0
Comment
Question by:TLTEO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Author Comment

by:TLTEO
ID: 6475846
InputStream is=new StringBufferInputStream(strdata);

is deprecated.

What is the new way ??
0
 
LVL 6

Accepted Solution

by:
kotan earned 20 total points
ID: 6475849
Use String Reader,

InputStream is = new StringReader(strdata)
0
 
LVL 6

Expert Comment

by:kotan
ID: 6475850
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
 

Author Comment

by:TLTEO
ID: 6475863
tks vm . Cheers
0
 

Author Comment

by:TLTEO
ID: 6475962
wrong I am getting error

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

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month12 days, 5 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question