×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: mustafakorkmz
Added: Jun 15, 2022 3:01 PM
Views: 8
Tags: no tags
  1.  
  2.  
  3.  
  4. String source = "This is the source of my input stream";
  5. InputStream in = org.apache.commons.io.IOUtils.toInputStream(source, "UTF-8");
  6.  
  7.  
  8.  
  9.  
  10. String str = "String contents";
  11. InputStream is = new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8));