Liking cljdoc? Tell your friends :D

helins.binf

Core namespace for handling views.

See README for an overview.

Core namespace for handling views.

See README for an overview.
raw docstring

backing-bufferclj/s

(backing-buffer view)

Returns the buffer of view if it does wrap one, nil otherwise.

It is possible to implement some protocols of this library over something that does not have a backing buffer. Actually, on the JVM, a DirectByteBuffer is an example of a supported view which operates over native memory instead of a Java byte array (ie. a "buffer").

Returns the buffer of `view` if it does wrap one, nil otherwise.

It is possible to implement some protocols of this library over something that does not have a backing buffer.
Actually, on the JVM, a `DirectByteBuffer` is an example of a supported view which operates over native memory
instead of a Java byte array (ie. a "buffer").
sourceraw docstring

buffer-offsetclj/s

(buffer-offset view)

Returns the offset relative to the backing buffer, nil if there is not any.

See backing-buffer for background.

Returns the offset relative to the backing buffer, nil if there is not any.

See [[backing-buffer]] for background.
sourceraw docstring

endian-getclj/s

(endian-get view)

Returns the endianess of the given view, either :big-endian or :little-endian.

Returns the endianess of the given `view`, either `:big-endian` or `:little-endian`.
sourceraw docstring

endian-setclj/s

(endian-set view endianess)

Sets the endianess of the given view, either :big-endian or :little-endian.

Sets the endianess of the given `view`, either `:big-endian` or `:little-endian`.
sourceraw docstring

garanteed?clj/s

(garanteed? view n-byte)

Returns true if the view can consume at least n-byte bytes from the current position.

Returns true if the `view` can consume at least `n-byte` bytes from the current position.
sourceraw docstring

growclj/s

(grow view n-additional-byte)

Returns a new view with n-additional-byte added, copying entirely the given view.

It is particularly useful when writing data of yet unknown length, providing the ability of growing as needed.

Returns a new view with `n-additional-byte` added, copying entirely the given `view`.

It is particularly useful when writing data of yet unknown length, providing the ability of
growing as needed.
sourceraw docstring

limitclj/s

(limit view)

Returns the number of bytes a view or a buffer contains.

Returns the number of bytes a view or a buffer contains.
sourceraw docstring

positionclj/s

(position view)

Returns the current position.

Returns the current position.
sourceraw docstring

ra-boolclj/s

(ra-bool view position)

Reads a boolean value from an absolute position.

Reads a boolean value from an absolute `position`.
sourceraw docstring

ra-bufferclj/s

(ra-buffer this position n-byte)
(ra-buffer this position n-byte buffer)
(ra-buffer view position n-byte buffer offset)

Reads n-byte bytes from an absolute position and returns them in a new buffer or in the given buffer at the specified offset (defaults to 0).

Reads `n-byte` bytes from an absolute `position` and returns them in a new buffer or in the
given `buffer` at the specified `offset` (defaults to 0).
sourceraw docstring

ra-f32clj/s

(ra-f32 view position)

Reads a 32-bit float from an absolute position.

Reads a 32-bit float from an absolute `position`.
sourceraw docstring

ra-f64clj/s

(ra-f64 view position)

Reads a 64-bit float from an absolute position.

Reads a 64-bit float from an absolute `position`.
sourceraw docstring

ra-i16clj/s

(ra-i16 view position)

Reads a signed 16-bit integer from an absolute position.

Reads a signed 16-bit integer from an absolute `position`.
sourceraw docstring

ra-i32clj/s

(ra-i32 view position)

Reads a signed 32-bit integer from an absolute position.

Reads a signed 32-bit integer from an absolute `position`.
sourceraw docstring

ra-i64clj/s

(ra-i64 view position)

Reads a signed 64-bit integer from an absolute position.

Reads a signed 64-bit integer from an absolute `position`.
sourceraw docstring

ra-i8clj/s

(ra-i8 view position)

Reads a signed 8-bit integer from an absolute position.

Reads a signed 8-bit integer from an absolute `position`.
sourceraw docstring

ra-stringclj/s

(ra-string view position n-byte)
(ra-string view decoder position n-byte)

Reads a string consisting of n-byte bytes from an absolute position.

A string decoder may be provided (default is UTF-8).

See helins.binf.string/decoder.

Reads a string consisting of `n-byte` bytes from an absolute `position`.

A string decoder may be provided (default is UTF-8).

See [[helins.binf.string/decoder]].
sourceraw docstring

ra-u16clj/s

(ra-u16 view position)

Reads an unsigned 16-bit integer from an absolute position.

Reads an unsigned 16-bit integer from an absolute `position`.
sourceraw docstring

ra-u32clj/s

(ra-u32 view position)

Reads an unsigned 32-bit integer from an absolute position.

Reads an unsigned 32-bit integer from an absolute `position`.
sourceraw docstring

ra-u64clj/s

(ra-u64 view position)

Reads an unsigned 64-bit integer from an absolute position.

Reads an unsigned 64-bit integer from an absolute `position`.
sourceraw docstring

ra-u8clj/s

(ra-u8 view position)

Reads an unsigned 8-bit integer from an absolute position.

Reads an unsigned 8-bit integer from an absolute `position`.
sourceraw docstring

remainingclj/s

(remaining view)

Returns the number of bytes remaining until the end of the view given the current position.

Returns the number of bytes remaining until the end of the view given the current position.
sourceraw docstring

rr-boolclj/s

(rr-bool view)

Reads a boolean value from the current position.

Reads a boolean value from the current position.
sourceraw docstring

rr-bufferclj/s

(rr-buffer view n-byte)
(rr-buffer view n-byte buffer)
(rr-buffer view n-byte buffer offset)

Reads n-byte and returns them in a new buffer or in the given one at the specified offset (defaults to 0).

Reads `n-byte` and returns them in a new buffer or in the given one at the specified `offset`
(defaults to 0).
sourceraw docstring

rr-f32clj/s

(rr-f32 view)

Reads a 32-bit float from the current position.

Reads a 32-bit float from the current position.
sourceraw docstring

rr-f64clj/s

(rr-f64 view)

Reads a 64-bit float from the current position.

Reads a 64-bit float from the current position.
sourceraw docstring

rr-i16clj/s

(rr-i16 view)

Reads a signed 16-bit integer from the current position.

Reads a signed 16-bit integer from the current position.
sourceraw docstring

rr-i32clj/s

(rr-i32 view)

Reads a signed 32-bit integer from the current position.

Reads a signed 32-bit integer from the current position.
sourceraw docstring

rr-i64clj/s

(rr-i64 view)

Reads a signed 64-bit integer from the current position.

Reads a signed 64-bit integer from the current position.
sourceraw docstring

rr-i8clj/s

(rr-i8 view)

Reads a signed 8-bit integer from the current position.

Reads a signed 8-bit integer from the current position.
sourceraw docstring

rr-stringclj/s

(rr-string view n-byte)
(rr-string view decoder n-byte)

Reads a string consisting of n-byte bytes from the current position.

A non-nil decoder may be provided (default is UTF-8).

See helins.binf.string/decoder.

Reads a string consisting of `n-byte` bytes from the current position.

A non-nil decoder may be provided (default is UTF-8).

See [[helins.binf.string/decoder]].
sourceraw docstring

rr-u16clj/s

(rr-u16 view)

Reads an unsigned 16-bit integer from the current position.

Reads an unsigned 16-bit integer from the current position.
sourceraw docstring

rr-u32clj/s

(rr-u32 view)

Reads an unsigned 32-bit integer from the current position.

Reads an unsigned 32-bit integer from the current position.
sourceraw docstring

rr-u64clj/s

(rr-u64 view)

Reads an unsigned 64-bit integer from the current position.

Reads an unsigned 64-bit integer from the current position.
sourceraw docstring

rr-u8clj/s

(rr-u8 view)

Reads an unsigned 8-bit integer from the current position.

Reads an unsigned 8-bit integer from the current position.
sourceraw docstring

seekclj/s

(seek view position)

Modifies the current position.

Modifies the current position.
sourceraw docstring

skipclj/s

(skip view n-byte)

Advances the current position by n-byte bytes.

Advances the current position by `n-byte` bytes.
sourceraw docstring

viewclj/s

(view viewable)
(view viewable offset)
(view viewable offset n-byte)

A view can be created from a buffer (see helins.binf.buffer/alloc) or from another view.

An offset as well as a size (n-byte) may be provided.

(def my-buffer
     (binf.buffer/alloc 100))

;; View with an offset of 50 bytes, 40 bytes long
(def my-view
     (binf/view my-buffer
                50
                40))

;; View from a view, offset of 60 bytes in the original buffer (50 + 10), 20 bytes long
(def inner-view
     (binf/view my-view
                10
                20))
A view can be created from a buffer (see [[helins.binf.buffer/alloc]]) or from another view.

An `offset` as well as a size (`n-byte`) may be provided.

```clojure
(def my-buffer
     (binf.buffer/alloc 100))

;; View with an offset of 50 bytes, 40 bytes long
(def my-view
     (binf/view my-buffer
                50
                40))

;; View from a view, offset of 60 bytes in the original buffer (50 + 10), 20 bytes long
(def inner-view
     (binf/view my-view
                10
                20))
```
sourceraw docstring

wa-b16clj/s

(wa-b16 view position int)

Writes a 16-bit integer to an absolute position.

Writes a 16-bit integer to an absolute `position`.
sourceraw docstring

wa-b32clj/s

(wa-b32 view position int)

Writes a 32-bit integer to an absolute position.

Writes a 32-bit integer to an absolute `position`.
sourceraw docstring

wa-b64clj/s

(wa-b64 view position int64)

Writes a 64-bit integer to an absolute position.

Writes a 64-bit integer to an absolute `position`.
sourceraw docstring

wa-b8clj/s

(wa-b8 view position int)

Writes an 8-bit integer to an absolute position.

Writes an 8-bit integer to an absolute position.
sourceraw docstring

wa-boolclj/s

(wa-bool view position true?)

Writes a boolean value to an absolute position.

Writes a boolean value to an absolute `position`.
sourceraw docstring

wa-bufferclj/s

(wa-buffer view position buffer)
(wa-buffer view position buffer offset)
(wa-buffer view position buffer offset n-byte)

Copies the given buffer to an absolute position.

An offset in the buffer as well as a number of bytes to copy (n-byte) may be provided.

Copies the given `buffer` to an absolute `position`.

An `offset` in the buffer as well as a number of bytes to copy (`n-byte`) may be provided.
sourceraw docstring

wa-f32clj/s

(wa-f32 view position floating)

Writes a 32-bit float to an absolute position.

Writes a 32-bit float to an absolute `position`.
sourceraw docstring

wa-f64clj/s

(wa-f64 view position floating)

Writes a 64-bit float to an absolute position.

Writes a 64-bit float to an absolute `position`.
sourceraw docstring

wa-stringclj/s

(wa-string view position string)

Writes a string (encoded as UTF-8) to an absolute position.

Unlike other wa-* functions which are implemented as a fluent interface, this function returns a tuple indicating how many bytes and chars have been written, and if the process is finished: [finished? n-byte n-chars].

With that information, the user can continue writing if needed. On the JVM, the tuple contains a 4th item which is a CharBuffer containing the rest of the unwritten string which can be passed in place of the string argument.

Writes a string (encoded as UTF-8) to an absolute `position`.

Unlike other  `wa-*` functions which are implemented as a fluent interface, this function returns
a tuple indicating how many bytes and chars have been written, and if the process is finished:
`[finished? n-byte n-chars]`.

With that information, the user can continue writing if needed. On the JVM, the tuple contains a 4th
item which is a `CharBuffer` containing the rest of the unwritten string which can be passed in place
of the `string` argument.
sourceraw docstring

wr-b16clj/s

(wr-b16 view int)

Writes a 16-bit integer to the current position.

Writes a 16-bit integer to the current position.
sourceraw docstring

wr-b32clj/s

(wr-b32 view int)

Writes a 32-bit integer to the current position.

Writes a 32-bit integer to the current position.
sourceraw docstring

wr-b64clj/s

(wr-b64 view int)

Writes a 64-bit integer to the current position.

Writes a 64-bit integer to the current position.
sourceraw docstring

wr-b8clj/s

(wr-b8 view int)

Writes an 8-bit integer to the current position.

Writes an 8-bit integer to the current position.
sourceraw docstring

wr-boolclj/s

(wr-bool view true?)

Writes a boolean value from the current position.

Writes a boolean value from the current position.
sourceraw docstring

wr-bufferclj/s

(wr-buffer view buffer)
(wr-buffer view buffer offset)
(wr-buffer view buffer offset n-byte)

Copies the given buffer to the current position.

An offset in the buffer as well as a number of bytes to copy (n-byte) may be provided.

Copies the given `buffer` to the current position.

An `offset` in the buffer as well as a number of bytes to copy (`n-byte`) may be provided.
sourceraw docstring

wr-f32clj/s

(wr-f32 view floating)

Writes a 32-bit float to the current position.

Writes a 32-bit float to the current position.
sourceraw docstring

wr-f64clj/s

(wr-f64 view floating)

Writes a 64-bit float to the current position.

Writes a 64-bit float to the current position.
sourceraw docstring

wr-stringclj/s

(wr-string view string)

Writes a string to the current position, encoded at UTF-8.

Cf. wa-string about the returned value

Writes a string to the current position, encoded at UTF-8.

Cf. [[wa-string]] about the returned value
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close