Package fr.dyade.aaa.util.backup
Class RestoreFile
- java.lang.Object
-
- java.io.RandomAccessFile
-
- fr.dyade.aaa.util.backup.RestoreFile
-
- All Implemented Interfaces:
Closeable,DataInput,DataOutput,AutoCloseable
public class RestoreFile extends RandomAccessFile implements Closeable
Class allowing to handles a backup file.
-
-
Constructor Summary
Constructors Constructor Description RestoreFile(File file)Opens a backup file to restore it.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voiddump(File file, Pattern filter)Dumps the objects contained in the backup file.static voidextract(File backupFile, Pattern filter, File extractDir)Extracts the objects contained in the backup file to the specified directory.intgetNbRecords()Number of objects recorded in the file.BackupRecordgetNextRecord()Reads the next record in file.static voidlist(File file, Pattern filter)Lists the objects contained in the backup file.-
Methods inherited from class java.io.RandomAccessFile
close, 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
-
RestoreFile
public RestoreFile(File file) throws IOException
Opens a backup file to restore it.- Parameters:
file- The file to restore.- Throws:
IOException- An error occurs.
-
-
Method Detail
-
getNbRecords
public int getNbRecords()
Number of objects recorded in the file.- Returns:
- the number of objects recorded in the file.
-
getNextRecord
public BackupRecord getNextRecord() throws IOException
Reads the next record in file.- Returns:
- the next record in file.
- Throws:
IOException- An error occurs.
-
list
public static void list(File file, Pattern filter) throws IOException
Lists the objects contained in the backup file.- Parameters:
file- The backup file.filter- The filter.- Throws:
IOException- An error occurs.
-
extract
public static void extract(File backupFile, Pattern filter, File extractDir) throws IOException
Extracts the objects contained in the backup file to the specified directory.- Parameters:
backupFile- The backup file.filter- The filter.extractDir- The directory where to extract the data.- Throws:
IOException- An error occurs.
-
dump
public static void dump(File file, Pattern filter) throws IOException
Dumps the objects contained in the backup file.- Parameters:
file- The backup file.filter- The filter.- Throws:
IOException- An error occurs.
-
-