docs: JournalSegment<E> createSegment(JournalSegmentDescriptor descriptor) {
      File segmentFile = JournalSegmentFile.createSegmentFile(name, directory, descriptor.id());
  
      RandomAccessFile raf;
      FileChannel channel;
      try {
        raf = new RandomAccessFile(segmentFile, "rw");
        raf.setLength(descriptor.maxSegmentSize());
        channel =  raf.getChannel();
      } catch (IOException e) {
        throw new StorageException(e);
      }
  
      ByteBuffer buffer = ByteBuffer.allocate(JournalSegmentDescriptor.BYTES);
      descriptor.copyTo(buffer);
      buffer.flip();
      try {
        channel.write(buffer);
      } catch (IOException e) {
        throw new StorageException(e);
      } finally {
        try {
          channel.close();
          raf.close();
        } catch (IOException e) {
        }
      }
      JournalSegment<E> segment = newSegment(new JournalSegmentFile(segmentFile), descriptor);
      log.debug("Created segment: {}", segment);
      return segment;
    }