 
 (defn put-byte-at
   "Puts a byte to the given position in `buffer`."
-  [^Buffer buffer ^long pos ^long value]
-  (let [pos' (get-pos buffer)]
+  [^Buffer buffer ^long position ^long value]
+  (let [position' (get-position buffer)]
     (doto buffer
-      (set-pos pos)
+      (set-position position)
       (put-byte value)
-      (set-pos pos'))))
+      (set-position position'))))
 
 (defn take-boolean
   "Takes a boolean from `buffer`."

(deftype MikronByteBufferFactory []
  IMikronByteBufferFactory
  (allocate* [_ size]
    (MikronByteBuffer.
      #?@(:clj  [(.order (ByteBuffer/allocateDirect size) (ByteOrder/nativeOrder))]
          :cljs [(.allocUnsafe NativeJsBuffer size) 0 true])))
  (wrap* [_ binary]
    (MikronByteBuffer.
      #?@(:clj  [(ByteBuffer/wrap binary)]
          :cljs [(.from NativeJsBuffer binary) 0 true]))))

(def ^mikron.runtime.buffer.IMikronByteBufferFactory byte-buffer-factory
  "The default byte buffer factory."

(defn allocate
  "Allocates a buffer with the size `size`."
  ^Buffer [^long size]
  (Buffer. (MikronBitBuffer. 0 0 -1) (allocate* byte-buffer-factory size)))

(defn wrap
  "Wraps a binary value `binary` with a buffer."
  ^Buffer [^bytes binary]
  (Buffer. (MikronBitBuffer. 0 0 -1) (wrap* byte-buffer-factory binary)))

(defn set-headers
  "Sets the headers of `buffer`."
