public bool SaveJsonAsync(string data, string directory, string folder, string filename, ref string fullpath) { try { Java.IO.File folderDirectory = null; if (!string.IsNullOrEmpty(folder)) { folderDirectory = new Java.IO.File(directory, folder); folderDirectory.Mkdirs(); } FileStream fileOS = new FileStream(directory + "/" + folder + "/" + filename, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write); Java.IO.BufferedWriter buf1 = new Java.IO.BufferedWriter(new Java.IO.OutputStreamWriter(fileOS)); buf1.Write(data, 0, data.Length); buf1.Flush(); buf1.Close(); } catch { return(false); } return(true); }
private void WriteFileContent(string path, string content) { FileStream fileOS = new FileStream(path, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite); Java.IO.BufferedWriter buf1 = new Java.IO.BufferedWriter(new Java.IO.OutputStreamWriter(fileOS)); buf1.Write(content, 0, content.Length); buf1.Flush(); buf1.Close(); }