private Segment createMemorySegment(SegmentDescriptor descriptor){
  File segmentFile=SegmentFile.createSegmentFile(name,storage.directory(),descriptor.id(),descriptor.version());
  Buffer buffer=HeapBuffer.allocate(Math.min(DEFAULT_BUFFER_SIZE,descriptor.maxSegmentSize()),Integer.MAX_VALUE);
  descriptor.copyTo(buffer);
  Segment segment=new Segment(new SegmentFile(segmentFile),buffer.slice(),descriptor,createIndex(descriptor),new OffsetPredicate(),serializer.clone(),this);
  LOGGER.debug("Created segment: {}",segment);
  return segment;
}

private Segment createMemorySegment ( SegmentDescriptor descriptor ) { File segmentFile = SegmentFile . createSegmentFile ( name , storage . directory ( ) , descriptor . id ( ) , descriptor . version ( ) ) ; Buffer buffer = HeapBuffer . allocate ( Math . min ( DEFAULT_BUFFER_SIZE , descriptor . maxSegmentSize ( ) ) , Integer . MAX_VALUE ) ; descriptor . copyTo ( buffer ) ; Segment segment = new Segment ( new SegmentFile ( segmentFile ) , buffer . slice ( ) , descriptor , createIndex ( descriptor ) , new OffsetPredicate ( ) , serializer . clone ( ) , this ) ; LOGGER . debug ( "Created segment: {}" , segment ) ; return segment ; }
creates a new segment .
