Java String Buffer to InputStream
import java.io.ByteArrayInputStream;
import java.io.InputStream;
public class StringBufferToInputStreamExample
{
public static void main(String args[])
{
StringBuffer sbf = new
StringBuffer("StringBuffer to InputStream Example");
byte[] bytes = sbf.toString().getBytes();
InputStream inputStream = new
ByteArrayInputStream(bytes);
System.out.println("StringBuffer
converted to InputStream");
}
}
No comments:
Post a Comment