Solved

convert string to inputstream

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

How can I put into an InputStream.

0
Comment
Question by:TLTEO
  • 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 5 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now