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 can u create the object with out new operator

2 Answers  


How to reduce flicking in animation?

3 Answers   TCS,


What is aggregation?

1 Answers   Cap Gemini,


What are instance variables?

0 Answers  


Which class is the superclass of all classes?

0 Answers  






What is a copy constructor in java?

0 Answers   Amazon,


Can we write multiple catch blocks under single try block?

0 Answers  


Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.

0 Answers   Amdocs,


Why do we use threads in java?

0 Answers  


Does windows 10 need java?

0 Answers  


When finalize method is called?

3 Answers  


How can be define MARKER interfce in java

1 Answers  


Categories