int appendFromDirectly(byte[] byteArray, int offset, int length) throws StoreException {
    if (!fileChannel.isOpen()) {
      throw new StoreException("Channel is closed while writing to segment via direct IO",
          StoreErrorCodes.ChannelClosed);
    }
    validateAppendSize(length);

    try {
      directIOExecutor.execute(directIo -> {
        directIo.position(endOffset.get());
        directIo.writeBytes(byteArray, offset, length);
        return null;
      });
      endOffset.addAndGet(length);
    } catch (IOException e) {
      StoreErrorCodes errorCode = StoreException.resolveErrorCode(e);
      throw new StoreException(errorCode.toString() + " while writing into segment via direct IO", e, errorCode);
    }
    return length;
  }
<p/>
Attempts to write the {@code byteArray} to this segment in direct IO manner.
<p/>
The write is not started if it cannot be completed.
@param byteArray The bytes from which data needs to be written from.
@param offset The offset in the byteArray to start with.
@param length The amount of data in bytes to use from the byteArray.
@throws IllegalArgumentException if there is not enough space for data of size {@code length}.
@throws StoreException if data could not be written to the file because of I/O errors
ambry-store/src/main/java/com/github/ambry/store/LogSegment.java