<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Db on mahroot's blog</title><link>https://mahroot.dev/tags/db/</link><description>Recent content in Db on mahroot's blog</description><generator>Hugo</generator><language>en-us</language><copyright>&lt;a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="noopener"&gt;CC BY-NC 4.0&lt;/a&gt;</copyright><lastBuildDate>Tue, 13 Jan 2026 19:37:47 +0100</lastBuildDate><atom:link href="https://mahroot.dev/tags/db/index.xml" rel="self" type="application/rss+xml"/><item><title>Crafting My Own Storage Engine-Part 01: Java I/O Fundamentals</title><link>https://mahroot.dev/posts/crafting-my-own-storage-engine-part-01--java-io-fundamentals/</link><pubDate>Tue, 13 Jan 2026 19:37:47 +0100</pubDate><guid>https://mahroot.dev/posts/crafting-my-own-storage-engine-part-01--java-io-fundamentals/</guid><description>&lt;h1 id="the-page-abstraction"&gt;The &amp;ldquo;Page&amp;rdquo; Abstraction&lt;/h1&gt;
&lt;p&gt;so the &lt;code&gt;ByteBuffer&lt;/code&gt; acts like a staging area where we serialize our Java objects (the &lt;code&gt;Page&lt;/code&gt; object) into raw bytes and keep them in RAM using methods like &lt;code&gt;putInt&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and after that, we need to persist the data to disk — meaning we write those bytes into a file so the data survives after the program stops&lt;/p&gt;
&lt;p&gt;so we have one large file, and since all pages have a fixed size, if we want to write the data for &lt;code&gt;pageId = 14&lt;/code&gt;, we simply compute the offset &lt;code&gt;4096 * 14&lt;/code&gt; and write the buffer at that position using the &lt;code&gt;write&lt;/code&gt; method&lt;/p&gt;</description></item></channel></rss>