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

What is the purpose of declaring a variable as final?

0 Answers  


does java support pointers?

0 Answers  


Difference between vector and arraylist.

0 Answers  


Is the milky way in a void?

0 Answers  


After compilation of java program we'll get .class code. If it's generated in OS Windows XP will it work on OS Linux? If yes why? If no why?

5 Answers   Aricent,


How do you declare an array in java?

0 Answers  


What is default specifier ??? Use of default specifier ???

4 Answers   Cognizant, Syntel,


Difference between hashCode() & equals()?

3 Answers   HCL,


What does escaping a character mean?

0 Answers  


what is difference between String buffer and String builder?

5 Answers   Benchmark,


what is d difference between deep cloning and shallow cloning in core java?

3 Answers   Satyam,


What is the Layout for ToolBar?

1 Answers  


Categories