How can you take string into InputStream?

Answers were Sorted based on User's Feedback



How can you take string into InputStream?..

Answer / sudhakar p

Step 1: Convert String to byte array

Step 2: Create a ByteArrayInputStream passing bytes[] to to
the contructor

Is This Answer Correct ?    4 Yes 0 No

How can you take string into InputStream?..

Answer / himanshu gupta

String str="";
int i=0
InputStream in=new FileInputStream("File url");

while((i=in.read())!=-1)
{
str=str+(char)i;
}
System.out.println(str);

Is This Answer Correct ?    1 Yes 0 No

How can you take string into InputStream?..

Answer / neema

string are converted to bytes and taken to FileInputStream

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Core Java Interview Questions

Can a abstract class be defined without any abstract methods?

0 Answers  


What is an Iterator interface?

2 Answers  


What are null interfaces? Give some examples?

2 Answers  


Is java same as core java?

0 Answers  


Is java free for businesses?

0 Answers  


How java is platform independent?

41 Answers   College School Exams Tests, Infosys, TCS,


How to perform binary search in java?

0 Answers  


What is exception propagation?

0 Answers  


Can an interface extend a class?

0 Answers  


What is the use of Getters and Setters method ?

4 Answers  


Why static functions are used?

0 Answers  


what are the differences between final,finally,finalize methods?

14 Answers   IBM,


Categories