ByteBuffer read() throws IOException {
    if (!canRead()) {
      throw new IOException("Target file hasn't been specified.");
    }
    // TODO: Reuse the file stream
    try (WALInputStream is = openReadFileStream()) {
      is.skipToGivenLogicalPosition(position);
      ByteBuffer buffer = ByteBuffer.allocate(size);
      is.read(buffer);
      return buffer;
    } catch (Exception e) {
      LOGGER.error(
          "Unexpected error when reading a wal entry from {}@{} with size {}",
          walFile,
          position,
          size,
          e);
      throw new IOException(e);
    }
  }
Read the byte buffer directly.

@throws IOException failing to read.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/utils/WALEntryPosition.java