com.sleepycat.db

## Interface BackupHandler

    public interface BackupHandler

An interface that can optionally be used to override the default behavior performed by the `Environment.backup` and `Environment.backupDatabase` methods. Implementation of this interface is required if the Environment.backup or Environment.backupDatabase target parameter is null.

You configure the environment with this handler using the `EnvironmentConfig.setBackupHandler` method.

### Method Summary

All Methods Instance Methods Abstract Methods
`int` `close(java.lang.String dbname)` Called when ending a backup and closing a backup target.
`int` `open(java.lang.String target, java.lang.String dbname)` Called when a target location is opened during a backup.
`int` `write(long file_pos, byte[] buf, int off, int len)` Called when writing data during a backup.

### Method Detail

#### close

    int close(java.lang.String dbname)

Called when ending a backup and closing a backup target.

Parameters:
  `dbname` - The name of the database that has been backed up.
Returns:
  error code; zero if there is no error

#### open

    int open(java.lang.String target,
             java.lang.String dbname)

Called when a target location is opened during a backup. This method should do whatever is necessary to prepare the backup destination for writing the data.

Parameters:
  `target` - The backup's directory destination.

  `dbname` - The name of the database being backed up.
Returns:
  error code; zero if there is no error

#### write

    int write(long file_pos,
              byte[] buf,
              int off,
              int len)

Called when writing data during a backup.

Parameters:
  `file_pos` - Identifies the position in the target file where the bytes from the buffer should be written.

  `buf` - Identifies the buffer which contains the data to be backed up.

  `off` - Specifies the start of the data in the buffer. This will always be zero.

  `len` - Identifies the number of bytes to back up from the buffer.
Returns:
  error code; zero if there is no error