code: public static void save(CharSequence chars, OutputStream outputStream) throws IOException
    {
      if(chars != null) {
        ByteArrayInputStream inputStream = new ByteArrayInputStream(chars.toString().getBytes());
        Files.copy(inputStream, outputStream);
      }
    }
docs: Copy source characters to requested output bytes stream. If given <code>chars</code> parameter is null or empty
  this method does nothing.
  
  @param chars source characters stream,
  @param outputStream target bytes stream.
  @throws IOException if copy operation fails.