@Override
    public void append(long streamSegmentId, long offset, byte[] data) throws StreamSegmentNotExistsException {
        Exceptions.checkNotClosed(this.closed.get(), this);
        log.debug("{}: append (StreamSegmentId = {}, Offset = {}, DataLength = {}).", this.traceObjectId, streamSegmentId, offset, data.length);

        // Append the data to the StreamSegment Index. It performs further validation with respect to offsets, etc.
        StreamSegmentReadIndex index = getOrCreateIndex(streamSegmentId);
        Exceptions.checkArgument(!index.isMerged(), "streamSegmentId", "StreamSegment is merged. Cannot append to it anymore.");
        index.append(offset, data);
    }
@ Override public void append ( long streamSegmentId , long offset , byte [ ] data ) throws StreamSegmentNotExistsException { Exceptions . checkNotClosed ( this . closed . get ( ) , this ) ; log . debug ( "{}: append (StreamSegmentId = {}, Offset = {}, DataLength = {})." , this . traceObjectId , streamSegmentId , offset , data . length ) ; StreamSegmentReadIndex index = getOrCreateIndex ( streamSegmentId ) ; Exceptions . checkArgument ( ! index . isMerged ( ) , "streamSegmentId" , "StreamSegment is merged. Cannot append to it anymore." ) ; index . append ( offset , data ) ; }
region ReadIndex Implementation