Package fr.dyade.aaa.util.backup
Class BackupFile
- java.lang.Object
-
- java.io.RandomAccessFile
-
- fr.dyade.aaa.util.backup.BackupFile
-
- All Implemented Interfaces:
Closeable,DataInput,DataOutput,AutoCloseable
public class BackupFile extends RandomAccessFile implements Closeable
Class allowing to create a backup file.
-
-
Constructor Summary
Constructors Constructor Description BackupFile(File file)Creates a new backup file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackup(BackupRecord record)Backups an object in the file.voidclose()Closes the backup file.intgetNbRecords()Number of objects recorded in the file.-
Methods inherited from class java.io.RandomAccessFile
getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
-
-
-
Constructor Detail
-
BackupFile
public BackupFile(File file) throws IOException
Creates a new backup file.- Parameters:
file- The file to create.- Throws:
IOException- An error occurs during creation.
-
-
Method Detail
-
getNbRecords
public int getNbRecords()
Number of objects recorded in the file.- Returns:
- the number of objects recorded in the file.
-
backup
public void backup(BackupRecord record) throws IOException
Backups an object in the file.- Parameters:
buf- the byte array to store.dirName- the directory name of the object.name- the name of the object.- Throws:
IOException- An error occurs.
-
close
public void close() throws IOExceptionCloses the backup file.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classRandomAccessFile- Throws:
IOException- An error occurs.
-
-