Solved

convert string to inputstream

Posted on 2001-09-11
5
384 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

757 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

20 Experts available now in Live!

Get 1:1 Help Now