I have a text file to load from assets folder of an android app to "/sdcard/appname/" but i want the lines to be randomize and save while copied to sdcard, here is the code that i write to copy but i struck at the part of how to randomize
data_path="/sdcard/<appname>/"
AssetManager assetManager = getAssets();
InputStream in = assetManager.open("file.txt");
OutputStream out = new FileOutputStream(data_path + "file.txt");
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
//while ((lenf = gin.read(buff)) > 0) {
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
//gin.close();
out.close();
How can i randomize the lines while copying (i'm not a java guy started working on it recently so this is kind of a noob question)
Aucun commentaire:
Enregistrer un commentaire