String root = android.os.Environment.getExternalStorageDirectory().getPath(); File myFile = new File(root,"testfile.txt"); FileChannel rwChannel = new RandomAccessFile(myFile, "rw").getChannel(); int numBytes = (int)rwChannel.size(); ByteBuffer buffer = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, numBytes); System.out.println("buffer"+buffer); byte[] randomBytes = new byte[numBytes]; new Random().nextBytes(randomBytes); buffer.put(randomBytes); rwChannel.write(buffer); rwChannel.close();
File.createTempFile(String prefix, String suffix, File directory)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)