ES2.AppendRaw
Append Raw Bytes
public static void AppendRaw(byte[] bytes, string path, ES2Settings settings=null)
Parameters
[table th=”0″]bytes,”The raw bytes which we want to append to our file.”
path,”The path of the file we want to create to store our data, or append to if it already exists. For more information, see Paths.”
settings,”Optional. A user-created ES2Settings object containing options not specified in path.”[/table]
Description
Appends these bytes to the end of the specified file, or creates the file with these bytes if it doesn’t exist.
Note: Path should point to a file.
C#
// Create a file containing the bytes ABC123ABC123. byte[] bytes = new byte[]{'A','B','C','1','2','3'}; ES2.AppendRaw(bytes, "myFile.txt"); ES2.AppendRaw(bytes, "myFile.txt");
JS
// Create a file containing the bytes ABC123ABC123. var bytes = ['A','B','C','1','2','3']; ES2.AppendRaw(bytes, "myFile.txt"); ES2.AppendRaw(bytes, "myFile.txt");
Append Raw String
public static void AppendRaw(string data, string path, ES2Settings settings=null)
Parameters
[table th=”0″]data,”The raw string representing to be appended to our file. It will be stored in the UTF8 encoding.”
path,”The path of the file we want to create to store our data, or append to if it already exists. For more information, see Paths.”
settings,”Optional. A user-created ES2Settings object containing options not specified in path.”[/table]
Description
Appends this string to the end of the specified file as a UTF8 string, or creates the file with this string if it doesn’t exist.
Note: Path should point to a file.
C#
// Create a file containing our own text. ES2.AppendRaw("I think", "myFile.txt"); ES2.AppendRaw("therefore I am.", "myFile.txt");
JS
// Create a file containing our own text. ES2.AppendRaw("I think", "myFile.txt"); ES2.AppendRaw("therefore I am.", "myFile.txt");
Append Raw Text Asset
public static void AppendRaw(TextAsset data, string path, ES2Settings settings=null)
Parameters
[table th=”0″]data,”The TextAsset we want to append to the file.”
path,”The path of the file we want to create to append our data to, which should have the extension .bytes. For more information, see Paths.”
settings,”Optional. A user-created ES2Settings object containing options not specified in path.”[/table]
Description
Saves a TextAsset as a file which will contain the same bytes as the TextAsset, or appends to the file if it already exists.
Note: The TextAsset must have the extension ‘.bytes’.
Note: Path should point to a file.
C#
// Appends one TextAsset to another as a file. TextAsset file1 = Resources.Load("myFile1") as TextAsset; TextAsset file2 = Resources.Load("myFile2") as TextAsset; ES2.AppendRaw(file1, "file1And2.txt"); ES2.AppendRaw(file2, "file1And2.txt");
JS
// Appends one TextAsset to another as a file. var file1 : TextAsset = Resources.Load("myFile1") as TextAsset; var file2 : TextAsset = Resources.Load("myFile2") as TextAsset; ES2.AppendRaw(file1, "file1And2.txt"); ES2.AppendRaw(file2, "file1And2.txt");