Java Files  «Prev  Next»


Random Access File Constructors

public RandomAccessFile(String filename, String mode) throws IOException
public RandomAccessFile(File file, String mode) throws IOException

The first argument to the constructor is the file you want to access. The second argument is the mode for access. The mode should either be the string literal r for read-only access or the string rw for read and write access. Java does not support write-only access.

Use streams to read from and write to files by using classes in the java.io package including
BufferedReader, BufferedWriter, File,
FileReader, FileWriter, DataInputStream, DataOutputStream,
ObjectOutputStream, ObjectInputStream, and PrintWriter