Java Program to Convert OutputStream to String
Program:
import java.io.*;
public class OutputStreamString {
public static void main(String[] args) throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
String line = "Welcome ENGINEERSIQ";
stream.write(line.getBytes());
String finalString = new String(stream.toByteArray());
System.out.println(finalString);
}
}
No comments:
Post a Comment