public class DirectAccessFile
extends java.lang.Object
| Constructor and Description |
|---|
DirectAccessFile(java.lang.String fileName,
long recordLength)
constructor for objects of class DirectAccessFile
opens file for reading & writing or throws an I/O exception
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(java.lang.String s)
appends string to the end of the file
|
void |
close()
closes the pointer to the random access file or throws an exception
|
boolean |
delete(long position)
Deletes the currect record.
|
long |
getLength()
returns length of the file in bytes or throws an I/O exception
|
long |
getNumberOfRecords()
according to file length and length of one record it returns num.
|
long |
getRecordLength()
returns length of one record
|
void |
goToRecord(long i)
moves the file pointer to a different record or throws an exception
|
boolean |
isReady()
checks if the file is ready for manipulation
|
java.lang.String |
read()
reads and returns string - content of current record or throws an exception
|
java.lang.String |
read(long record)
reads and returns string - content of record given or throws an exception
|
void |
shortenFile()
shortens file to the current number of records - the rest of the file is cut off
or throws an exception
|
void |
write(java.lang.String s)
writes string to the current record or throws an exception
|
void |
write(java.lang.String s,
long record)
writes string to the record given or throws an exception
|
public DirectAccessFile(java.lang.String fileName, long recordLength)
fileName
- name of file to work withrecordLength
- number of bytes of one record in a filepublic boolean isReady()
public long getLength()
public long getRecordLength()
public long getNumberOfRecords()
public void goToRecord(long i)
i
- position of the recordpublic void write(java.lang.String s)
s
- string to write into filepublic void write(java.lang.String s, long record)
s
- string to write into filerecord
- position to which string should be writtenpublic java.lang.String read()
public java.lang.String read(long record)
public void close()
public void shortenFile()
public void append(java.lang.String s)
s
- string to appendpublic boolean delete(long position)
position
- number of record


USER
Profile
User's MAP:
User's STATS:
Total Distance Traveled:
Total Time Traveled:
Comments:
Stats:
Difference in Distance:
Difference in Time:
Close