Class DbFileRewriter
- java.lang.Object
-
- com.healthmarketscience.jackcess.crypt.impl.DbFileRewriter
-
public class DbFileRewriter extends Object
Runs a whole file rewrite of a database, and holds the page level file work the rewrites share. Adding or removing encryption touches every page and cannot be undone half way, so the work always builds a separate file and the original is replaced only once that file is complete. An interrupted rewrite leaves the original as it was.- Author:
- James Ahlborn
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDbFileRewriter.RewriteThe work one rewrite performs, reading the source database and writing the destination.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidrewriteInPlace(Path dbFile, DbFileRewriter.Rewrite op)Rewrites the given database in place, replacing it with the result.static voidrewriteTo(Path srcFile, Path dstFile, DbFileRewriter.Rewrite op)Rewrites the given database into the given destination, which must not be the source and is overwritten if it exists.
-
-
-
Method Detail
-
rewriteTo
public static void rewriteTo(Path srcFile, Path dstFile, DbFileRewriter.Rewrite op) throws IOException
Rewrites the given database into the given destination, which must not be the source and is overwritten if it exists.- Throws:
IOException
-
rewriteInPlace
public static void rewriteInPlace(Path dbFile, DbFileRewriter.Rewrite op) throws IOException
Rewrites the given database in place, replacing it with the result.The replacement gives the database a new identity on disk, so any hard link to it keeps the contents the rewrite started with, and an open handle on it keeps reading the old file. The database must not be in use.
- Throws:
IOException
-
-