ComputerDictionaries.org      Computer terms spelled out...
Home -› RS -› RandomAccessFile
Online dictionary
From all dictionaries     Only from this dictionary
 

Dictionaries by Category


High-Tech News

Definition Of:

RandomAccessFile

RSJDK Doc (JAVA)
- class java.io..RandomAccessFile 
public class RandomAccessFile extends Object implements DataOutput , DataInput 
Tree:java.lang.Object - java.io.RandomAccessFile
Instances of this class support both reading and writing to a random access file. A random access file behaves like a large array of bytes stored in the file system. There is a kind of cursor, or index into the implied array, called the ; input operations read bytes starting at the file pointer and advance the file pointer past the bytes read. If the random access file is created in read/write mode, then output operations are also available; output operations write bytes starting at the file pointer and advance the file pointer past the bytes written. Output operations that write past the current end of the implied array cause the array to be extended. The file pointer can be read by the getFilePointer method and set by the seek method.
 
- Constructor for class java.io.RandomAccessFile 
public RandomAccessFile (File Â file, String Â mode) throws IOException 
Creates a random access file stream to read from, and optionally to write to, the file specified by the File argument. A new FileDescriptor object is created to represent this file connection. The mode argument must either be equal to "r" or "rw", indicating that the file is to be opened for input only or for both input and output, respectively. The write methods on this object will always throw an IOException if the file is opened with a mode of "r". If the mode is "rw" and the file does not exist, then an attempt is made to create it. An IOException is thrown if the file argument refers to a directory. If there is a security manager, its checkRead method is called with the pathname of the file argument as its argument to see if read access to the file is allowed. If the mode is "rw", the security manager's checkWrite method is also called with the path argument to see if write access to the file is allowed.Parameters: file - the file object. - the access mode.mode - the access mode.Throws: IllegalArgumentException - if the mode argument is not equal to "r" or to "rw". - if the file exists but is a directory rather than a regular file, or cannot be opened or created for any other reasonFileNotFoundException - if the file exists but is a directory rather than a regular file, or cannot be opened or created for any other reason - if a security manager exists and its method denies read access to the file or the mode is "rw" and the security manager's method denies write access to the file.SecurityException - if a security manager exists and its checkRead method denies read access to the file or the mode is "rw" and the security manager's checkWrite method denies write access to the file.See Also:  File.getPath() , SecurityManager.checkRead(java.lang.String) , SecurityManager.checkWrite(java.lang.String)
 
- Constructor for class java.io.RandomAccessFile 
public RandomAccessFile (String Â name, String Â mode) throws FileNotFoundException 
Creates a random access file stream to read from, and optionally to write to, a file with the specified name. A new FileDescriptor object is created to represent the connection to the file. The mode argument must either be equal to "r" or "rw", indicating that the file is to be opened for input only or for both input and output, respectively. The write methods on this object will always throw an IOException if the file is opened with a mode of "r". If the mode is "rw" and the file does not exist, then an attempt is made to create it. An IOException is thrown if the name argument refers to a directory. If there is a security manager, its checkRead method is called with the name argument as its argument to see if read access to the file is allowed. If the mode is "rw", the security manager's checkWrite method is also called with the name argument as its argument to see if write access to the file is allowed.Parameters: name - the system-dependent filename. - the access mode.mode - the access mode.Throws: IllegalArgumentException - if the mode argument is not equal to "r" or to "rw". - if the file exists but is a directory rather than a regular file, or cannot be opened or created for any other reasonFileNotFoundException - if the file exists but is a directory rather than a regular file, or cannot be opened or created for any other reason - if a security manager exists and its method denies read access to the file or the mode is "rw" and the security manager's method denies write access to the file.SecurityException - if a security manager exists and its checkRead method denies read access to the file or the mode is "rw" and the security manager's checkWrite method denies write access to the file.See Also:  SecurityException , SecurityManager.checkRead(java.lang.String) , SecurityManager.checkWrite(java.lang.String)
See also: , , , ,