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

How many types of design patterns are there?

0 Answers  


what is synchronization? : Java thread

0 Answers  


what is the major difference between linkedlist and arraylist in java?

0 Answers   IBS,


What do you understand by overloading and overriding in java?

0 Answers  


What does jenkins do?

0 Answers  


What are predicates in java 8?

0 Answers  


What is the lifetime and scope of a variable?

0 Answers  


Define a package.

0 Answers  


I am unable to find or learn about print command. I have a graphical program in core java in applet but i want to give print command but i have coding for that so if anyone know about this plz mail me on avdhesh_chauhan007@yahoo.co.in

0 Answers  


Is arraylist ordered in java?

0 Answers  


what is difference between method overloading & method overridding with example?

4 Answers   IBM,


Can you make a constructor final in Java?

0 Answers   SwanSoft Technologies,


Categories