public BootstrapMetadata read() throws Exception {
        Path path = Paths.get(directoryPath);
        if (!Files.isDirectory(path)) {
            if (Files.exists(path)) {
                throw new RuntimeException("Path " + directoryPath + " exists, but is not " +
                        "a directory.");
            } else {
                throw new RuntimeException("No such directory as " + directoryPath);
            }
        }
        Path binaryBootstrapPath = Paths.get(directoryPath, BINARY_BOOTSTRAP_FILENAME);
        if (!Files.exists(binaryBootstrapPath)) {
            return readFromConfiguration();
        } else {
            return readFromBinaryFile(binaryBootstrapPath.toString());
        }
    }
Create a new BootstrapDirectory object.

@param directoryPath     The path to the directory with the bootstrap file.
@param ibp               The configured value of inter.broker.protocol, or the empty string
                         if it is not configured.
metadata/src/main/java/org/apache/kafka/metadata/bootstrap/BootstrapDirectory.java