How can you take string into InputStream?
Answers were Sorted based on User's Feedback
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 |
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 |
What are meta-annotations?
Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?
How to make a read-only class in java?
What are static blocks in java ?
Is ruby built on java?
Can java hashmap have duplicate keys?
A class can be a subclass of itself?
What is type inference in java8?
What is one third plus one third as a fraction?
What is main in java?
What is ternary operator?
What is the difference between synchronized and synchronized block?