public static Fd create(StorageSegment segment, Path path, boolean openFd) throws IOException {
            ByteBufferWriter.PredictSizeOpener opener = size -> {
                FileChannel file = FileChannel.open(path,
                        StandardOpenOption.WRITE,
                        StandardOpenOption.CREATE,
                        StandardOpenOption.TRUNCATE_EXISTING);
                ByteBufferWriter writer = ByteBufferWriter.of(file, 0);
                writer.setName(path.toString());
                return writer;
            };
            ByteBufferReader.Opener reader = openFd ? ByteBufferReader.Opener.create(path) : null;
            return create(segment, opener, reader);
        }
Integrate a segment into an {@link IntegratedSegment}.

@param segment The segment to integrate.
@param path    The destination file which generated segment will write into.
@param openFd  Open segment fd or not.
@return A {@link Fd} pointed to the integrated segment.
indexr-segment/src/main/java/io/indexr/segment/storage/itg/IntegratedSegment.java