RandomAccessFile
发布网友
发布时间:2022-04-09 10:30
我来回答
共2个回答
热心网友
时间:2022-04-09 12:00
RandomAccessFile(File file, String mode)
Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument.
"r" Open for reading only. Invoking any of the write methods of the resulting object will cause an IOException to be thrown.
"rw" Open for reading and writing. If the file does not already exist then an attempt will be made to create it.
"rws" Open for reading and writing, as with "rw", and also require that every update to the file's content or metadata be written synchronously to the underlying storage device.
"rwd" Open for reading and writing, as with "rw", and also require that every update to the file's content be written synchronously to the underlying storage device.
热心网友
时间:2022-04-09 13:18
RandomAccessFile s1=new RandomAccessFile("E:/t.txt","rw");
前者是路径和文件名,后者是对文件具有的权限,比如“rw”是可读可写