Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

convert string to inputstream

Posted on 2001-09-11
5
Medium Priority
?
427 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

610 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