public static DatabaseImpl create(FileFormat fileFormat,File mdbFile,FileChannel channel,boolean autoSync,Charset charset,TimeZone timeZone) throws IOException {
  FileFormatDetails details=getFileFormatDetails(fileFormat);
  if (details.getFormat().READ_ONLY) {
    throw new IOException("File format " + fileFormat + " does not support writing for "+ mdbFile);
  }
  if (details.getEmptyFilePath() == null) {
    throw new IOException("File format " + fileFormat + " does not support file creation for "+ mdbFile);
  }
  boolean closeChannel=false;
  if (channel == null) {
    channel=openChannel(mdbFile,false);
    closeChannel=true;
  }
  boolean success=false;
  try {
    channel.truncate(0);
    transferFrom(channel,getResourceAsStream(details.getEmptyFilePath()));
    channel.force(true);
    DatabaseImpl db=new DatabaseImpl(mdbFile,channel,closeChannel,autoSync,fileFormat,charset,timeZone,null);
    success=true;
    return db;
  }
  finally {
    if (!success && closeChannel) {
      ByteUtil.closeQuietly(channel);
    }
  }
}

public static DatabaseImpl create ( FileFormat fileFormat , File mdbFile , FileChannel channel , boolean autoSync , Charset charset , TimeZone timeZone ) throws IOException { FileFormatDetails details = getFileFormatDetails ( fileFormat ) ; if ( details . getFormat ( ) . READ_ONLY ) { throw new IOException ( "File format " + fileFormat + " does not support writing for " + mdbFile ) ; } if ( details . getEmptyFilePath ( ) == null ) { throw new IOException ( "File format " + fileFormat + " does not support file creation for " + mdbFile ) ; } boolean closeChannel = false ; if ( channel == null ) { channel = openChannel ( mdbFile , false ) ; closeChannel = true ; } boolean success = false ; try { channel . truncate ( 0 ) ; transferFrom ( channel , getResourceAsStream ( details . getEmptyFilePath ( ) ) ) ; channel . force ( true ) ; DatabaseImpl db = new DatabaseImpl ( mdbFile , channel , closeChannel , autoSync , fileFormat , charset , timeZone , null ) ; success = true ; return db ; } finally { if ( ! success && closeChannel ) { ByteUtil . closeQuietly ( channel ) ; } } }
create a new database for the given fileformat
