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

If goto and const is reserve words than why it is not work in java?

0 Answers  


What is compile time polymorphism?

20 Answers   CTS, Elementus Technologies, Oracle,


Which java ide is used the most?

0 Answers  


How thread scheduler schedule the task?

0 Answers  


Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?

0 Answers  






What is the minimum and maximum length of an identifier?

6 Answers   TCS,


What is the use of predicate in java 8?

0 Answers  


What is a literal coding?

0 Answers  


What is bitwise complement?

0 Answers  


What are the different ways to handle exceptions?

0 Answers  


How does singleton class work?

0 Answers  


A person says that he compiled a java class successfully without even having a main method in it? Is it possible?

0 Answers  


Categories